diff --git a/benches/call.rs b/benches/call.rs index 9eca3bc6cd53..8e7d95aa8ffb 100644 --- a/benches/call.rs +++ b/benches/call.rs @@ -1,5 +1,3 @@ -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] - use criterion::measurement::WallTime; use criterion::{criterion_group, criterion_main, BenchmarkGroup, Criterion}; use std::fmt::Debug; @@ -445,7 +443,7 @@ trait ToVals { macro_rules! tuples { ($($t:ident)*) => ( - #[allow(non_snake_case)] + #[allow(non_snake_case, reason = "macro-generated code")] impl<$($t:Copy + Into,)*> ToVals for ($($t,)*) { fn to_vals(&self) -> Vec { let mut _dst = Vec::new(); @@ -534,7 +532,7 @@ mod component { macro_rules! tuples { ($($t:ident)*) => ( - #[allow(non_snake_case)] + #[allow(non_snake_case, reason = "macro-generated code")] impl<$($t:Copy + ToComponentVal,)*> ToComponentVals for ($($t,)*) { fn to_component_vals(&self) -> Vec { let mut _dst = Vec::new(); diff --git a/cranelift/filetests/src/function_runner.rs b/cranelift/filetests/src/function_runner.rs index 2feae28e0183..bc00b1be7dbc 100644 --- a/cranelift/filetests/src/function_runner.rs +++ b/cranelift/filetests/src/function_runner.rs @@ -528,7 +528,10 @@ fn make_trampoline(name: UserFuncName, signature: &ir::Signature, isa: &dyn Targ #[cfg(target_arch = "x86_64")] use std::arch::x86_64::__m128i; #[cfg(target_arch = "x86_64")] -#[allow(improper_ctypes_definitions)] +#[expect( + improper_ctypes_definitions, + reason = "manually verified to work for now" +)] extern "C" fn __cranelift_x86_pshufb(a: __m128i, b: __m128i) -> __m128i { union U { reg: __m128i, diff --git a/cranelift/filetests/src/lib.rs b/cranelift/filetests/src/lib.rs index ab776ba5ea90..b09ba6560737 100644 --- a/cranelift/filetests/src/lib.rs +++ b/cranelift/filetests/src/lib.rs @@ -4,7 +4,6 @@ //! available filetest commands. #![deny(missing_docs)] -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] pub use crate::function_runner::TestFileCompiler; use crate::runner::TestRunner; diff --git a/cranelift/filetests/src/subtest.rs b/cranelift/filetests/src/subtest.rs index a0761ad9ba21..5321a4e1c9f0 100644 --- a/cranelift/filetests/src/subtest.rs +++ b/cranelift/filetests/src/subtest.rs @@ -29,7 +29,7 @@ pub struct Context<'a> { pub isa: Option<&'a dyn TargetIsa>, /// Full path to the file containing the test. - #[allow(dead_code)] + #[expect(dead_code, reason = "may get used later")] pub file_path: &'a str, /// Context used to update the original `file_path` in-place with its test diff --git a/cranelift/filetests/src/test_unwind.rs b/cranelift/filetests/src/test_unwind.rs index f9fe196dff02..7b01873af06d 100644 --- a/cranelift/filetests/src/test_unwind.rs +++ b/cranelift/filetests/src/test_unwind.rs @@ -108,7 +108,7 @@ mod windowsx64 { version: u8, flags: u8, prologue_size: u8, - #[allow(dead_code)] + #[expect(dead_code, reason = "may get used later")] unwind_code_count_raw: u8, frame_register: u8, frame_register_offset: u8, diff --git a/cranelift/frontend/src/lib.rs b/cranelift/frontend/src/lib.rs index 8f97474b2486..7a9c80919910 100644 --- a/cranelift/frontend/src/lib.rs +++ b/cranelift/frontend/src/lib.rs @@ -157,10 +157,7 @@ #![deny(missing_docs)] #![no_std] -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] -#[allow(unused_imports)] // #[macro_use] is required for no_std -#[macro_use] extern crate alloc; #[cfg(feature = "std")] diff --git a/cranelift/frontend/src/switch.rs b/cranelift/frontend/src/switch.rs index 24d0fb714bac..9605557a980a 100644 --- a/cranelift/frontend/src/switch.rs +++ b/cranelift/frontend/src/switch.rs @@ -348,8 +348,8 @@ mod tests { let block = bx.create_block(); bx.switch_to_block(block); let val = bx.ins().iconst(types::I8, 0); - #[allow(unused_mut)] let mut switch = Switch::new(); + let _ = &mut switch; $( let block = bx.create_block(); switch.set_entry($index, block); diff --git a/cranelift/module/src/lib.rs b/cranelift/module/src/lib.rs index eb78fcd5c46e..7528ad67caad 100644 --- a/cranelift/module/src/lib.rs +++ b/cranelift/module/src/lib.rs @@ -2,7 +2,6 @@ #![deny(missing_docs)] #![no_std] -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/module/src/module.rs b/cranelift/module/src/module.rs index d9494b851ed2..4a32837787ca 100644 --- a/cranelift/module/src/module.rs +++ b/cranelift/module/src/module.rs @@ -220,12 +220,10 @@ impl From for ModuleRelocTarget { feature = "enable-serde", derive(serde_derive::Serialize, serde_derive::Deserialize) )] +#[allow(missing_docs, reason = "self-describing fields")] pub struct FunctionDeclaration { - #[allow(missing_docs)] pub name: Option, - #[allow(missing_docs)] pub linkage: Linkage, - #[allow(missing_docs)] pub signature: ir::Signature, } @@ -379,14 +377,11 @@ pub type ModuleResult = Result; feature = "enable-serde", derive(serde_derive::Serialize, serde_derive::Deserialize) )] +#[allow(missing_docs, reason = "self-describing fields")] pub struct DataDeclaration { - #[allow(missing_docs)] pub name: Option, - #[allow(missing_docs)] pub linkage: Linkage, - #[allow(missing_docs)] pub writable: bool, - #[allow(missing_docs)] pub tls: bool, } diff --git a/cranelift/reader/src/lexer.rs b/cranelift/reader/src/lexer.rs index 28d75feb5137..76b36e1920de 100644 --- a/cranelift/reader/src/lexer.rs +++ b/cranelift/reader/src/lexer.rs @@ -3,8 +3,6 @@ use crate::error::Location; use cranelift_codegen::ir::types; use cranelift_codegen::ir::{Block, Value}; -#[allow(unused_imports, deprecated)] -use std::ascii::AsciiExt; use std::str::CharIndices; use std::u16; diff --git a/cranelift/reader/src/lib.rs b/cranelift/reader/src/lib.rs index 7dbc732b28e6..e4d5ea95e030 100644 --- a/cranelift/reader/src/lib.rs +++ b/cranelift/reader/src/lib.rs @@ -4,7 +4,6 @@ //! testing Cranelift, but is not essential for a JIT compiler. #![deny(missing_docs)] -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] pub use crate::error::{Location, ParseError, ParseResult}; pub use crate::isaspec::{parse_option, parse_options, IsaSpec, ParseOptionError}; @@ -30,7 +29,7 @@ use std::str::FromStr; use target_lexicon::Triple; /// Like `FlagsOrIsa`, but holds ownership. -#[allow(missing_docs)] +#[allow(missing_docs, reason = "self-describing variants")] pub enum OwnedFlagsOrIsa { Flags(settings::Flags), Isa(OwnedTargetIsa), diff --git a/cranelift/reader/src/run_command.rs b/cranelift/reader/src/run_command.rs index 0c1b2876d362..2fa616539694 100644 --- a/cranelift/reader/src/run_command.rs +++ b/cranelift/reader/src/run_command.rs @@ -105,7 +105,7 @@ impl Display for Invocation { } /// A CLIF comparison operation; e.g. `==`. -#[allow(missing_docs)] +#[allow(missing_docs, reason = "self-describing variants")] #[derive(Debug, PartialEq)] pub enum Comparison { Equals, diff --git a/crates/component-macro/tests/codegen.rs b/crates/component-macro/tests/codegen.rs index c9124aa665cb..73d61fd99539 100644 --- a/crates/component-macro/tests/codegen.rs +++ b/crates/component-macro/tests/codegen.rs @@ -1,5 +1,4 @@ -#![allow(dead_code)] -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] +#![allow(dead_code, reason = "lots of macro-generated code")] macro_rules! gentest { ($id:ident $name:tt $path:tt) => { @@ -135,7 +134,6 @@ mod trappable_errors_with_versioned_and_unversioned_packages { }, }); - #[allow(dead_code)] type MyX = u64; } @@ -177,7 +175,6 @@ mod trappable_errors { }, }); - #[allow(dead_code)] type MyX = u32; } diff --git a/crates/wasi-keyvalue/tests/main.rs b/crates/wasi-keyvalue/tests/main.rs index b84e9b059ad0..6ae8eee18a56 100644 --- a/crates/wasi-keyvalue/tests/main.rs +++ b/crates/wasi-keyvalue/tests/main.rs @@ -1,5 +1,3 @@ -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] - use anyhow::{anyhow, Result}; use test_programs_artifacts::{foreach_keyvalue, KEYVALUE_MAIN_COMPONENT}; use wasmtime::{ @@ -48,7 +46,7 @@ async fn run_wasi(path: &str, ctx: Ctx) -> Result<()> { macro_rules! assert_test_exists { ($name:ident) => { - #[allow(unused_imports)] + #[expect(unused_imports, reason = "just here to assert it exists")] use self::$name as _; }; } diff --git a/crates/wasi-nn/tests/check/mod.rs b/crates/wasi-nn/tests/check/mod.rs index ff21fee38d4d..32e175cdff7a 100644 --- a/crates/wasi-nn/tests/check/mod.rs +++ b/crates/wasi-nn/tests/check/mod.rs @@ -4,10 +4,6 @@ //! - that various backends can be located on the system (see sub-modules) //! - that certain ML model artifacts can be downloaded and cached. -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] - -#[allow(unused_imports)] -use anyhow::{anyhow, Context, Result}; use std::{ env, path::{Path, PathBuf}, @@ -15,7 +11,7 @@ use std::{ sync::Mutex, }; -#[cfg(any(feature = "onnx", feature = "winml"))] +#[cfg(any(feature = "onnx", all(feature = "winml", target_os = "windows")))] pub mod onnx; #[cfg(feature = "openvino")] pub mod openvino; diff --git a/crates/wasi-nn/tests/check/onnx.rs b/crates/wasi-nn/tests/check/onnx.rs index b5a451e0373f..cdbec420de22 100644 --- a/crates/wasi-nn/tests/check/onnx.rs +++ b/crates/wasi-nn/tests/check/onnx.rs @@ -1,8 +1,5 @@ -#![allow(unused)] - use super::{artifacts_dir, download, DOWNLOAD_LOCK}; use anyhow::{Context, Result}; -use std::sync::Mutex; use std::{env, fs}; /// Return `Ok` if we find the cached MobileNet test artifacts; this will diff --git a/examples/mpk.rs b/examples/mpk.rs index 59edaaabf086..8b850d2edbdb 100644 --- a/examples/mpk.rs +++ b/examples/mpk.rs @@ -31,8 +31,6 @@ //! $ sysctl vm.max_map_count=$LARGER_LIMIT //! ``` -#![expect(clippy::allow_attributes_without_reason, reason = "crate not migrated")] - use anyhow::anyhow; use bytesize::ByteSize; use clap::Parser; @@ -115,7 +113,6 @@ fn probe_engine_size(args: &Args, mpk: MpkEnabled) -> Result { } #[derive(Debug)] -#[allow(dead_code)] struct Pool { num_memories: u32, mapped_bytes: usize,