From f69269f962d8e761cac228ed3320526f98baac51 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Wed, 15 Jan 2025 17:25:07 +0000 Subject: [PATCH] refactor(traverse): remove unnecessary `#[allow]` --- crates/oxc_traverse/scripts/lib/ancestor.mjs | 1 - crates/oxc_traverse/scripts/lib/traverse.mjs | 2 +- crates/oxc_traverse/src/context/ancestry.rs | 4 ++-- crates/oxc_traverse/src/context/scoping.rs | 2 +- crates/oxc_traverse/src/generated/ancestor.rs | 1 - crates/oxc_traverse/src/generated/traverse.rs | 2 +- 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/oxc_traverse/scripts/lib/ancestor.mjs b/crates/oxc_traverse/scripts/lib/ancestor.mjs index c1716cbd09fdf..3a876e04ef278 100644 --- a/crates/oxc_traverse/scripts/lib/ancestor.mjs +++ b/crates/oxc_traverse/scripts/lib/ancestor.mjs @@ -131,7 +131,6 @@ export default function generateAncestorsCode(types) { /// Used in [\`crate::TraverseCtx::retag_stack\`]. #[repr(u16)] #[derive(Clone, Copy)] - #[allow(dead_code)] pub(crate) enum AncestorType { None = 0, ${ancestorTypeEnumVariants} diff --git a/crates/oxc_traverse/scripts/lib/traverse.mjs b/crates/oxc_traverse/scripts/lib/traverse.mjs index f13e1481a292b..58a74e05f1aa5 100644 --- a/crates/oxc_traverse/scripts/lib/traverse.mjs +++ b/crates/oxc_traverse/scripts/lib/traverse.mjs @@ -24,7 +24,7 @@ export default function generateTraverseTraitCode(types) { use crate::TraverseCtx; - #[allow(unused_variables)] + #[expect(unused_variables)] pub trait Traverse<'a> { ${traverseMethods} } diff --git a/crates/oxc_traverse/src/context/ancestry.rs b/crates/oxc_traverse/src/context/ancestry.rs index 0056896cd9348..dcf483c133652 100644 --- a/crates/oxc_traverse/src/context/ancestry.rs +++ b/crates/oxc_traverse/src/context/ancestry.rs @@ -160,7 +160,7 @@ impl<'a> TraverseAncestry<'a> { /// # SAFETY /// This method must not be public outside this crate, or consumer could break safety invariants. #[inline] - #[allow(unused_variables, clippy::needless_pass_by_value)] + #[expect(unused_variables, clippy::needless_pass_by_value)] pub(crate) fn pop_stack(&mut self, token: PopToken) { // SAFETY: `PopToken`s are only created in `push_stack`, so the fact that caller provides one // guarantees that a push has happened. This method consumes the token which guarantees another @@ -191,7 +191,7 @@ impl<'a> TraverseAncestry<'a> { /// /// This method must not be public outside this crate, or consumer could break safety invariants. #[inline] - #[allow(unsafe_code, clippy::ptr_as_ptr, clippy::ref_as_ptr)] + #[expect(clippy::ptr_as_ptr, clippy::ref_as_ptr)] pub(crate) unsafe fn retag_stack(&mut self, ty: AncestorType) { debug_assert!(self.stack.len() >= 2); *(self.stack.last_mut() as *mut _ as *mut AncestorType) = ty; diff --git a/crates/oxc_traverse/src/context/scoping.rs b/crates/oxc_traverse/src/context/scoping.rs index d86e139c0c704..a11a7a8e6e9c2 100644 --- a/crates/oxc_traverse/src/context/scoping.rs +++ b/crates/oxc_traverse/src/context/scoping.rs @@ -286,7 +286,7 @@ impl TraverseScoping { /// what was found in AST. /// i.e. if source contains identifiers `_foo` and `__bar`, create UIDs names `___0`, `___1`, /// `___2` etc. They'll all be unique within the program. - #[allow(clippy::missing_panics_doc)] + #[expect(clippy::missing_panics_doc)] pub fn generate_uid_name(&mut self, name: &str) -> CompactStr { // If `uid_names` is not already populated, initialize it if self.uid_names.is_none() { diff --git a/crates/oxc_traverse/src/generated/ancestor.rs b/crates/oxc_traverse/src/generated/ancestor.rs index 46a49d12c0e4b..bde90690aa633 100644 --- a/crates/oxc_traverse/src/generated/ancestor.rs +++ b/crates/oxc_traverse/src/generated/ancestor.rs @@ -21,7 +21,6 @@ use oxc_syntax::scope::ScopeId; /// Used in [`crate::TraverseCtx::retag_stack`]. #[repr(u16)] #[derive(Clone, Copy)] -#[allow(dead_code)] pub(crate) enum AncestorType { None = 0, ProgramHashbang = 1, diff --git a/crates/oxc_traverse/src/generated/traverse.rs b/crates/oxc_traverse/src/generated/traverse.rs index fe19d7f0b5543..7c09f1e2d9823 100644 --- a/crates/oxc_traverse/src/generated/traverse.rs +++ b/crates/oxc_traverse/src/generated/traverse.rs @@ -7,7 +7,7 @@ use oxc_ast::ast::*; use crate::TraverseCtx; -#[allow(unused_variables)] +#[expect(unused_variables)] pub trait Traverse<'a> { #[inline] fn enter_program(&mut self, node: &mut Program<'a>, ctx: &mut TraverseCtx<'a>) {}