design-lint: contract/unsafe-allow names craft-appkit and craft-wayland

Both crate docs say the rule names them; ALLOWED listed only craft-win32 and the benchmark allocator.
This commit is contained in:
bflatastic
2026-11-22 08:18:38 +07:00
parent 81266c36d0
commit de4ebd397b
@@ -1,5 +1,5 @@
//! `contract/unsafe-allow`: no `allow(unsafe_code)` in source, except in craft-win32 and the benchmark's allocator
//! (`ALLOWED`). Every other crate keeps the workspace `forbid`.
//! `contract/unsafe-allow`: no `allow(unsafe_code)` in source, except in the platform crates craft-win32, craft-appkit
//! and craft-wayland and in the benchmark's allocator (`ALLOWED`). Every other crate keeps the workspace `forbid`.
use std::path::Path;
@@ -13,9 +13,9 @@ use super::Cx;
pub const ID: &str = "contract/unsafe-allow";
/// The places that may allow `unsafe_code`, as path prefixes relative to the repository root, as in findings:
/// craft-win32, which holds the Windows FFI calls (the owner's exception, 2026-11-08), and the benchmark's global
/// allocator.
pub(crate) const ALLOWED: [&str; 2] = ["crates/win32/src", "crates/ui-bench/src/alloc.rs"];
/// craft-win32, which holds the Windows FFI calls (the owner's exception, 2026-11-08), craft-appkit and craft-wayland,
/// which hold the macOS and Wayland ones, and the benchmark's global allocator.
pub(crate) const ALLOWED: [&str; 4] = ["crates/win32/src", "crates/appkit/src", "crates/wayland/src", "crates/ui-bench/src/alloc.rs"];
struct Allows {
spans: Vec<proc_macro2::Span>,
@@ -42,6 +42,12 @@ pub(super) fn check(cx: &Cx<'_>, out: &mut Vec<Finding>) {
let mut allows = Allows { spans: Vec::new() };
allows.visit_file(cx.file);
for span in allows.spans {
cx.flag_span(out, ID, ID, span, "`allow(unsafe_code)`; only craft-win32 and the benchmark allocator allow it".to_owned());
cx.flag_span(
out,
ID,
ID,
span,
"`allow(unsafe_code)`; only craft-win32, craft-appkit, craft-wayland and the benchmark allocator allow it".to_owned(),
);
}
}