From c247604b13cf1598f955ccb3a07f64ed4b20c716 Mon Sep 17 00:00:00 2001 From: piquel Date: Sun, 22 Nov 2026 19:46:19 +0100 Subject: [PATCH] chore(lint): unsafe code is a warning, which CI turns into an error --- Cargo.toml | 2 +- docs/dev/rust-conventions.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 16baab021..e6379c4ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ rust-version = "1.88" version = "0.1.0" [workspace.lints.rust] -unsafe_code = "forbid" +unsafe_code = "warn" missing_docs = "warn" # Every Clippy warning fails CI: `just rust lint` runs Clippy with `-D warnings`. diff --git a/docs/dev/rust-conventions.md b/docs/dev/rust-conventions.md index 0bd456d47..e13911c05 100644 --- a/docs/dev/rust-conventions.md +++ b/docs/dev/rust-conventions.md @@ -370,8 +370,9 @@ Never `#[allow]`: an exception is `#[expect(lint, reason = "...")]` on the small item it applies to, so it fails once the code no longer needs it, and the reason says why the lint is wrong there, such as `reason = "One arm per operation, so a new one cannot skip the decision."`. Clippy enforces both (`allow_attributes`, -`allow_attributes_without_reason`). The workspace forbids `unsafe`; were a crate -ever to need it, every block would carry a `// SAFETY:` comment +`allow_attributes_without_reason`). The workspace warns on `unsafe` (`unsafe_code`), +which fails the lint job; a block that must stay is an `#[expect(unsafe_code, reason += "...")]` on the smallest item, with a `// SAFETY:` comment on every block (`undocumented_unsafe_blocks`). ## Documentation and tests