diff --git a/Cargo.toml b/Cargo.toml index 8c6780f8f..0ceb7b95a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,11 +25,12 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(cov all = { level = "warn", priority = -1 } empty_docs = { level = "allow", priority = 1 } # From `Tsify` # restriction -dbg_macro = "warn" -todo = "warn" -unimplemented = "warn" -print_stdout = "warn" # Must be opt-in -print_stderr = "warn" # Must be opt-in +dbg_macro = "warn" +todo = "warn" +unimplemented = "warn" +print_stdout = "warn" # Must be opt-in +print_stderr = "warn" # Must be opt-in +allow_attributes = "warn" # I like the explicitness of this rule as it removes confusion around `clone`. # This increases readability, avoids `clone` mindlessly and heap allocating by accident. clone_on_ref_ptr = "warn" diff --git a/tasks/ast_tools/src/codegen.rs b/tasks/ast_tools/src/codegen.rs index 4722b4448..78da48f8a 100644 --- a/tasks/ast_tools/src/codegen.rs +++ b/tasks/ast_tools/src/codegen.rs @@ -39,7 +39,7 @@ impl SideEffect { Ok(()) } - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] pub fn path(&self) -> Option { let Self(path, _) = self; let path = path.to_string_lossy(); @@ -63,7 +63,7 @@ impl From for SideEffect { pub trait Runner { type Context; type Output; - #[allow(dead_code)] + #[expect(dead_code)] fn name(&self) -> &'static str; fn run(&mut self, ctx: &Self::Context) -> Result; } diff --git a/tasks/ast_tools/src/derives/get_span.rs b/tasks/ast_tools/src/derives/get_span.rs index 4d44c969a..38a73ecc7 100644 --- a/tasks/ast_tools/src/derives/get_span.rs +++ b/tasks/ast_tools/src/derives/get_span.rs @@ -86,7 +86,7 @@ impl Derive for DeriveGetSpanMut { } } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] fn derive( trait_name: &str, method_name: &str, diff --git a/tasks/ast_tools/src/fmt.rs b/tasks/ast_tools/src/fmt.rs index 5e62cf049..df45187db 100644 --- a/tasks/ast_tools/src/fmt.rs +++ b/tasks/ast_tools/src/fmt.rs @@ -69,7 +69,7 @@ lazy_static! { /// /// We use this when inserting outer attributes (`#![allow(unused)]`) or plain comments (`//` not `///`). /// `quote!` macro ignores plain comments, so it's not possible to produce them otherwise. -#[allow(dead_code)] // `insert!` macro is not currently used +#[expect(dead_code)] // `insert!` macro is not currently used struct InsertReplacer; impl Replacer for InsertReplacer { @@ -109,7 +109,7 @@ lazy_static! { /// /// We use `endl!();` because `quote!` macro ignores whitespace, /// so we have to use another means to generate line breaks. -#[allow(dead_code)] // `endl!` macro is not currently used +#[expect(dead_code)] // `endl!` macro is not currently used struct EndlReplacer; impl Replacer for EndlReplacer { diff --git a/tasks/ast_tools/src/generators/ast_builder.rs b/tasks/ast_tools/src/generators/ast_builder.rs index 28366b1ec..55d50b661 100644 --- a/tasks/ast_tools/src/generators/ast_builder.rs +++ b/tasks/ast_tools/src/generators/ast_builder.rs @@ -150,7 +150,6 @@ fn generate_enum_variant_builder_fn( .or_else(|| var_type.transparent_type_id()) .and_then(|id| ctx.type_def(id)) .expect("type not found!"); - #[allow(clippy::single_match_else)] let (params, inner_builder) = match ty { TypeDef::Struct(it) => (get_struct_params(it, ctx), struct_builder_name(it)), TypeDef::Enum(_) => panic!("Unsupported!"), @@ -306,7 +305,7 @@ fn generate_struct_builder_fn(ty: &StructDef, ctx: &LateCtx) -> TokenStream { } // TODO: remove me -#[allow(dead_code)] +#[expect(dead_code)] #[derive(Debug)] struct Param { is_default: bool, @@ -415,7 +414,7 @@ impl<'p> DocComment<'p> { /// /// Each line will be turned into its own paragraph. // TODO: remove me - #[allow(dead_code)] + #[expect(dead_code)] pub fn with_description_lines(mut self, description: L) -> Self where S: Into>, diff --git a/tasks/ast_tools/src/generators/mod.rs b/tasks/ast_tools/src/generators/mod.rs index d7a02c183..e16f356d0 100644 --- a/tasks/ast_tools/src/generators/mod.rs +++ b/tasks/ast_tools/src/generators/mod.rs @@ -15,7 +15,7 @@ pub use ast_kind::AstKindGenerator; pub use visit::{VisitGenerator, VisitMutGenerator}; /// Inserts a newline in the `TokenStream`. -#[allow(unused)] +#[expect(unused)] macro_rules! endl { () => { /* only works in the context of `quote` macro family! */ @@ -51,12 +51,12 @@ pub(crate) use define_generator; /// Similar to how `insert` macro works in the context of `quote` macro family, But this one can be /// used outside and accepts expressions. /// Wraps the result of the given expression in `insert!({value here});` and outputs it as `TokenStream`. -#[allow(unused)] +#[expect(unused)] macro_rules! insert { ($fmt:literal $(, $args:expr)*) => {{ let txt = format!($fmt, $($args)*); format!(r#"insert!("{}");"#, txt).parse::().unwrap() }}; } -#[allow(unused_imports)] +#[expect(unused_imports)] pub(crate) use insert; diff --git a/tasks/ast_tools/src/generators/visit.rs b/tasks/ast_tools/src/generators/visit.rs index f57070bb4..8c217071c 100644 --- a/tasks/ast_tools/src/generators/visit.rs +++ b/tasks/ast_tools/src/generators/visit.rs @@ -534,7 +534,7 @@ impl<'a> VisitBuilder<'a> { enter_scope_at = ix; } - #[allow(unreachable_code)] + #[expect(unreachable_code)] if have_enter_node { // NOTE: this is disabled intentionally unreachable!("`#[visit(enter_before)]` attribute is disabled!"); diff --git a/tasks/ast_tools/src/layout.rs b/tasks/ast_tools/src/layout.rs index 8c2eb95f0..d8d58100b 100644 --- a/tasks/ast_tools/src/layout.rs +++ b/tasks/ast_tools/src/layout.rs @@ -55,7 +55,7 @@ impl KnownLayout { self.niches } - #[allow(unused)] + #[expect(unused)] #[inline] pub fn offsets(&self) -> Option<&Vec> { self.offsets.as_ref() diff --git a/tasks/ast_tools/src/markers.rs b/tasks/ast_tools/src/markers.rs index 5252df1ff..6521d5538 100644 --- a/tasks/ast_tools/src/markers.rs +++ b/tasks/ast_tools/src/markers.rs @@ -137,7 +137,7 @@ pub fn get_visit_markers<'a, I>(attrs: I) -> crate::Result where I: IntoIterator, { - #[allow(clippy::trivially_copy_pass_by_ref)] + #[expect(clippy::trivially_copy_pass_by_ref)] fn predicate(it: &&Attribute) -> bool { it.path().is_ident("visit") } @@ -186,7 +186,7 @@ pub fn get_scope_markers<'a, I>(attrs: I) -> crate::Result where I: IntoIterator, { - #[allow(clippy::trivially_copy_pass_by_ref)] + #[expect(clippy::trivially_copy_pass_by_ref)] fn predicate(it: &&Attribute) -> bool { it.path().is_ident("scope") } diff --git a/tasks/ast_tools/src/passes/calc_layout.rs b/tasks/ast_tools/src/passes/calc_layout.rs index 777e2d776..705c66e34 100644 --- a/tasks/ast_tools/src/passes/calc_layout.rs +++ b/tasks/ast_tools/src/passes/calc_layout.rs @@ -104,7 +104,7 @@ fn calc_enum_layout(ty: &mut Enum, ctx: &EarlyCtx) -> Result { } } - #[allow(clippy::needless_pass_by_value)] + #[expect(clippy::needless_pass_by_value)] fn fold_layout(mut acc: KnownLayout, layout: KnownLayout) -> KnownLayout { // SAFETY: we are folding valid layouts so it is safe. unsafe { diff --git a/tasks/ast_tools/src/passes/linker.rs b/tasks/ast_tools/src/passes/linker.rs index d26bbbc40..74f27eec8 100644 --- a/tasks/ast_tools/src/passes/linker.rs +++ b/tasks/ast_tools/src/passes/linker.rs @@ -10,7 +10,7 @@ pub trait Unresolved { fn unresolved(&self) -> bool; // TODO: remove me - #[allow(dead_code)] + #[expect(dead_code)] fn resolved(&self) -> bool { !self.unresolved() } diff --git a/tasks/ast_tools/src/rust_ast.rs b/tasks/ast_tools/src/rust_ast.rs index 64200dc67..775949a16 100644 --- a/tasks/ast_tools/src/rust_ast.rs +++ b/tasks/ast_tools/src/rust_ast.rs @@ -191,7 +191,7 @@ impl AstType { } } - #[allow(unused)] + #[expect(unused)] pub fn visitable(&self) -> bool { match self { AstType::Enum(it) => it.meta.visitable, @@ -450,7 +450,6 @@ pub fn analyze(ast_ref: &AstRef) -> Result<()> { AstType::Macro(_) => None, }; - #[allow(clippy::match_same_arms)] match ast_attr { Some(AstAttr::Visit) => { ast_ref.borrow_mut().set_ast(true)?; diff --git a/tasks/ast_tools/src/util.rs b/tasks/ast_tools/src/util.rs index 52e48353e..5be691c34 100644 --- a/tasks/ast_tools/src/util.rs +++ b/tasks/ast_tools/src/util.rs @@ -116,8 +116,6 @@ impl<'a> TypeIdentResult<'a> { } } -// TODO: remove me -#[allow(dead_code)] #[derive(Debug, PartialEq, Clone, Serialize)] pub enum TypeWrapper { None, diff --git a/tasks/benchmark/benches/sourcemap.rs b/tasks/benchmark/benches/sourcemap.rs index 839c3cbcd..691f69f03 100644 --- a/tasks/benchmark/benches/sourcemap.rs +++ b/tasks/benchmark/benches/sourcemap.rs @@ -6,7 +6,7 @@ use oxc_sourcemap::ConcatSourceMapBuilder; use oxc_span::SourceType; use oxc_tasks_common::TestFiles; -#[allow(clippy::cast_possible_truncation)] +#[expect(clippy::cast_possible_truncation)] fn bench_sourcemap(criterion: &mut Criterion) { let mut group = criterion.benchmark_group("sourcemap"); diff --git a/tasks/benchmark/src/lib.rs b/tasks/benchmark/src/lib.rs index d11106d64..ac1dc1449 100644 --- a/tasks/benchmark/src/lib.rs +++ b/tasks/benchmark/src/lib.rs @@ -27,7 +27,7 @@ static GLOBAL: NeverGrowInPlaceAllocator = NeverGrowInPlaceAllocator; pub struct NeverGrowInPlaceAllocator; // SAFETY: Methods simply delegate to `System` allocator -#[allow(unsafe_code, clippy::undocumented_unsafe_blocks)] +#[expect(unsafe_code, clippy::undocumented_unsafe_blocks)] unsafe impl GlobalAlloc for NeverGrowInPlaceAllocator { unsafe fn alloc(&self, layout: Layout) -> *mut u8 { System.alloc(layout) diff --git a/tasks/coverage/src/driver.rs b/tasks/coverage/src/driver.rs index 59f8ec93f..3e0c6e6de 100644 --- a/tasks/coverage/src/driver.rs +++ b/tasks/coverage/src/driver.rs @@ -2,8 +2,7 @@ use std::{collections::HashSet, ops::ControlFlow, path::PathBuf}; use oxc::CompilerInterface; -#[allow(clippy::wildcard_imports)] -use oxc::ast::{ast::*, Trivias}; +use oxc::ast::{ast::Program, Trivias}; use oxc::codegen::CodegenOptions; use oxc::diagnostics::OxcDiagnostic; use oxc::minifier::CompressOptions; @@ -17,7 +16,7 @@ use oxc::transformer::{TransformOptions, TransformerReturn}; use crate::suite::TestResult; -#[allow(clippy::struct_excessive_bools)] +#[expect(clippy::struct_excessive_bools)] #[derive(Default)] pub struct Driver { pub path: PathBuf, diff --git a/tasks/coverage/src/lib.rs b/tasks/coverage/src/lib.rs index b8f7afea7..35ecdda83 100644 --- a/tasks/coverage/src/lib.rs +++ b/tasks/coverage/src/lib.rs @@ -132,7 +132,7 @@ impl AppArgs { // Generate v8 test262 status file, which is used to skip failed tests // see https://chromium.googlesource.com/v8/v8/+/refs/heads/main/test/test262/test262.status - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc)] pub fn run_sync_v8_test262_status(&self) { let res = agent() .get("http://raw.githubusercontent.com/v8/v8/main/test/test262/test262.status") diff --git a/tasks/coverage/src/suite.rs b/tasks/coverage/src/suite.rs index cc6c7a1c7..8c7751dff 100644 --- a/tasks/coverage/src/suite.rs +++ b/tasks/coverage/src/suite.rs @@ -191,7 +191,7 @@ pub trait Suite { } /// # Errors - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] fn print_coverage( &self, name: &str, @@ -310,7 +310,7 @@ pub trait Case: Sized + Sync + Send + UnwindSafe { fn run(&mut self); /// Async version of run - #[allow(clippy::unused_async)] + #[expect(clippy::unused_async)] async fn run_async(&mut self) {} /// Execute the parser once and get the test result diff --git a/tasks/coverage/src/typescript/meta.rs b/tasks/coverage/src/typescript/meta.rs index 735be18a7..3d001c933 100644 --- a/tasks/coverage/src/typescript/meta.rs +++ b/tasks/coverage/src/typescript/meta.rs @@ -17,7 +17,7 @@ lazy_static::lazy_static! { static ref TEST_BRACES: Regex = Regex::new(r"^[[:space:]]*[{|}][[:space:]]*$").unwrap(); } -#[allow(unused)] +#[expect(unused)] #[derive(Debug)] pub struct CompilerSettings { pub modules: Vec, diff --git a/tasks/prettier_conformance/src/lib.rs b/tasks/prettier_conformance/src/lib.rs index c9706bedf..c5fe9710e 100644 --- a/tasks/prettier_conformance/src/lib.rs +++ b/tasks/prettier_conformance/src/lib.rs @@ -82,7 +82,7 @@ impl TestRunner { } /// # Panics - #[allow(clippy::cast_precision_loss)] + #[expect(clippy::cast_precision_loss)] pub fn run(mut self) { let fixture_root = &self.fixtures_root; // Read the first level of directories that contain `__snapshots__`