mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(traverse): remove unnecessary #[allow] (#8518)
Pure refactor. Remove unnecessary `#[allow]` attrs. Replace remaining ones with `#[expect]`.
This commit is contained in:
parent
209e313e40
commit
04bc25963d
8 changed files with 9 additions and 25 deletions
|
|
@ -112,9 +112,7 @@ export default function generateAncestorsCode(types) {
|
|||
}
|
||||
|
||||
return `
|
||||
#![allow(
|
||||
unsafe_code,
|
||||
clippy::missing_safety_doc,
|
||||
#![expect(
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::undocumented_unsafe_blocks,
|
||||
clippy::cast_ptr_alignment,
|
||||
|
|
@ -131,7 +129,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}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export default function generateTraverseTraitCode(types) {
|
|||
|
||||
use crate::TraverseCtx;
|
||||
|
||||
#[allow(unused_variables)]
|
||||
#[expect(unused_variables)]
|
||||
pub trait Traverse<'a> {
|
||||
${traverseMethods}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,15 +22,10 @@ export default function generateWalkFunctionsCode(types) {
|
|||
}
|
||||
|
||||
return `
|
||||
#![allow(
|
||||
unsafe_code,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::missing_panics_doc,
|
||||
clippy::undocumented_unsafe_blocks,
|
||||
#![expect(
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_as_ptr,
|
||||
clippy::borrow_as_ptr,
|
||||
clippy::cast_ptr_alignment
|
||||
)]
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
// Generated by `oxc_traverse/scripts/build.mjs`.
|
||||
// To alter this generated file you have to edit the codegen.
|
||||
|
||||
#![allow(
|
||||
unsafe_code,
|
||||
clippy::missing_safety_doc,
|
||||
#![expect(
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::undocumented_unsafe_blocks,
|
||||
clippy::cast_ptr_alignment,
|
||||
|
|
@ -21,7 +19,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,
|
||||
|
|
|
|||
|
|
@ -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>) {}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,10 @@
|
|||
// Generated by `oxc_traverse/scripts/build.mjs`.
|
||||
// To alter this generated file you have to edit the codegen.
|
||||
|
||||
#![allow(
|
||||
unsafe_code,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::missing_panics_doc,
|
||||
clippy::undocumented_unsafe_blocks,
|
||||
#![expect(
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_as_ptr,
|
||||
clippy::borrow_as_ptr,
|
||||
clippy::cast_ptr_alignment
|
||||
)]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue