Skip to content

Commit 1bb3716

Browse files
authored
refactor: Add #[deny(unused)] (#10997)
1 parent 758d8ec commit 1bb3716

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

.changeset/polite-items-check.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
swc_ecma_ast: patch
3+
swc_ecma_lexer: patch
4+
swc_ecma_minifier: patch
5+
swc_ecma_transforms_optimization: patch
6+
swc_ecma_usage_analyzer: patch
7+
---
8+
9+
refactor: deny unused

crates/swc_ecma_ast/src/list.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![allow(unused)]
21
#![allow(non_upper_case_globals)]
32
use bitflags::bitflags;
43

crates/swc_ecma_lexer/src/token.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ macro_rules! define_known_ident {
3535
),*
3636
}
3737

38-
#[allow(unused)]
3938
#[macro_export]
4039
macro_rules! known_ident_token {
4140
$(
@@ -47,7 +46,6 @@ macro_rules! define_known_ident {
4746
)*
4847
}
4948

50-
#[allow(unused)]
5149
#[macro_export]
5250
macro_rules! known_ident {
5351
$(
@@ -56,7 +54,6 @@ macro_rules! define_known_ident {
5654
};
5755
)*
5856
}
59-
#[allow(unused)]
6057
#[macro_export]
6158
macro_rules! ident_like {
6259
$(

crates/swc_ecma_minifier/src/compress/optimize/inline.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,9 +804,8 @@ impl Optimizer<'_> {
804804
}
805805
}
806806

807-
#[allow(unused)]
808807
match &decl {
809-
Decl::Class(c) => {
808+
Decl::Class(_) => {
810809
if self.options.inline != 3
811810
|| self.options.keep_classnames
812811
|| self.mangle_options.is_some_and(|v| v.keep_class_names)
@@ -822,7 +821,7 @@ impl Optimizer<'_> {
822821
c.ident.ctxt
823822
);
824823
}
825-
Decl::Fn(f) => {
824+
Decl::Fn(_) => {
826825
if self.options.keep_fnames
827826
|| self.mangle_options.is_some_and(|v| v.keep_fn_names)
828827
{

crates/swc_ecma_transforms_optimization/src/debug.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![allow(unused)]
22

3-
use std::{fmt::Debug, mem::forget};
4-
53
use swc_ecma_ast::*;
64
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
75

@@ -17,7 +15,7 @@ where
1715

1816
#[cfg(debug_assertions)]
1917
struct Ctx<'a> {
20-
v: &'a dyn Debug,
18+
v: &'a dyn std::fmt::Debug,
2119
}
2220

2321
#[cfg(debug_assertions)]
@@ -36,7 +34,7 @@ impl Visit for AssertValid {
3634
fn visit_expr(&mut self, n: &Expr) {
3735
let ctx = Ctx { v: n };
3836
n.visit_children_with(self);
39-
forget(ctx);
37+
std::mem::forget(ctx);
4038
}
4139

4240
#[cfg(debug_assertions)]
@@ -58,7 +56,7 @@ impl Visit for AssertValid {
5856
fn visit_stmt(&mut self, n: &Stmt) {
5957
let ctx = Ctx { v: n };
6058
n.visit_children_with(self);
61-
forget(ctx);
59+
std::mem::forget(ctx);
6260
}
6361

6462
#[cfg(debug_assertions)]

crates/swc_ecma_usage_analyzer/src/alias/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ where
154154
}
155155

156156
pub struct InfectionCollector {
157-
#[allow(unused)]
158157
config: AliasConfig,
159158
unresolved_ctxt: Option<SyntaxContext>,
160159

0 commit comments

Comments
 (0)