Skip to content

Commit 62bffed

Browse files
authored
refactor(rust): allow a few annoying clippy rules (#9588)
Seems like an annoying rule Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
1 parent c08b7fc commit 62bffed

File tree

15 files changed

+6
-29
lines changed

15 files changed

+6
-29
lines changed

Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ too_many_lines = "allow"
6969
must_use_candidate = "allow"
7070
# Too annoying, we import by name anyway.
7171
wildcard_imports = "allow"
72-
# used_underscore_binding= "allow"
7372
doc_markdown = "allow"
73+
similar_names = "allow"
74+
fn_params_excessive_bools = "allow"
75+
complexity = { level = "warn", priority = -1 }
76+
too_many_arguments = "allow"
7477
# nursery
7578
nursery = { level = "warn", priority = -1 }
7679
# `const` functions do not make sense for our project because this is not a `const` library.

apps/oxlint/src/command/lint.rs

-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ mod lint_options {
443443
}
444444

445445
#[test]
446-
#[expect(clippy::similar_names)]
447446
fn multiple_paths() {
448447
let temp_dir = tempfile::tempdir().expect("Could not create a temp dir");
449448
let file_foo = temp_dir.path().join("foo.js");

crates/oxc_ast/src/ast_builder_impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ impl<'a> AstBuilder<'a> {
287287
}
288288

289289
/// Build a [`Function`] with `scope_id`.
290-
#[expect(clippy::too_many_arguments)]
291290
#[inline]
292291
pub fn alloc_function_with_scope_id<T1, T2, T3, T4, T5>(
293292
self,

crates/oxc_ast/src/generated/ast_builder.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33

44
//! AST node factories
55
6-
#![expect(
7-
clippy::default_trait_access,
8-
clippy::too_many_arguments,
9-
clippy::fn_params_excessive_bools
10-
)]
6+
#![expect(clippy::default_trait_access)]
117

128
use std::cell::Cell;
139

crates/oxc_ecmascript/src/constant_evaluation/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ impl<'a> ConstantEvaluation<'a> for ComputedMemberExpression<'a> {
499499
}
500500
}
501501

502-
#[expect(clippy::similar_names)]
503502
fn is_less_than<'a>(
504503
ctx: &impl ConstantEvaluationCtx<'a>,
505504
x: &Expression<'a>,

crates/oxc_linter/src/module_graph_visitor.rs

-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ struct ModuleGraphVisitor {
142142
}
143143

144144
impl ModuleGraphVisitor {
145-
#[expect(clippy::too_many_arguments)]
146145
fn filter_fold_while<
147146
T,
148147
Filter: Fn(ModulePair, &ModuleRecord) -> bool,
@@ -172,7 +171,6 @@ impl ModuleGraphVisitor {
172171
.into_inner()
173172
}
174173

175-
#[expect(clippy::too_many_arguments)]
176174
fn filter_fold_recursive<
177175
T,
178176
Filter: Fn(ModulePair, &ModuleRecord) -> bool,

crates/oxc_linter/src/utils/express.rs

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ pub fn as_endpoint_registration<'a, 'n>(
4646
///
4747
/// This will yield a lot of false positives if not called on the results of
4848
/// [`as_endpoint_registration`].
49-
#[expect(clippy::similar_names)]
5049
pub fn is_endpoint_handler(maybe_handler: &Expression<'_>) -> bool {
5150
let params = match maybe_handler {
5251
Expression::FunctionExpression(f) => &f.params,

crates/oxc_parser/src/js/class.rs

-3
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ impl<'a> ParserImpl<'a> {
384384
}
385385
}
386386

387-
#[expect(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
388387
fn parse_class_method_definition(
389388
&mut self,
390389
span: Span,
@@ -449,7 +448,6 @@ impl<'a> ParserImpl<'a> {
449448
}
450449

451450
/// `FieldDefinition`[?Yield, ?Await] ;
452-
#[expect(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
453451
fn parse_class_property_definition(
454452
&mut self,
455453
span: Span,
@@ -501,7 +499,6 @@ impl<'a> ParserImpl<'a> {
501499
}
502500

503501
/// <https://github.com/tc39/proposal-decorators>
504-
#[expect(clippy::too_many_arguments, clippy::fn_params_excessive_bools)]
505502
fn parse_class_accessor_property(
506503
&mut self,
507504
span: Span,

crates/oxc_span/src/source_type/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ mod tests {
545545
}
546546

547547
#[test]
548-
#[expect(clippy::similar_names)]
549548
fn test_d_ts_from_path() {
550549
let dts = SourceType::from_path("foo.d.ts").unwrap();
551550
let dmts = SourceType::from_path("foo.d.mts").unwrap();

crates/oxc_transformer/src/common/duplicate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ impl<'a> TransformCtx<'a> {
5454
///
5555
/// Returns 3 `Expression`s. The first may be an `AssignmentExpression`,
5656
/// and must be inserted into output first.
57-
#[expect(clippy::similar_names)]
5857
pub(crate) fn duplicate_expression_twice(
5958
&self,
6059
expr: Expression<'a>,

crates/oxc_transformer/src/es2022/class_properties/private_field.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,6 @@ impl<'a> ClassProperties<'a, '_> {
21332133
/// * Setter: `_prop.call(_assertClassBrand(Class, object), value)`
21342134
/// * Prop: `_privateFieldSet(_prop, object, value)`
21352135
/// * Prop binding is `None`: `_writeOnlyError("#method")`
2136-
#[expect(clippy::too_many_arguments)]
21372136
fn create_private_setter(
21382137
&self,
21392138
private_name: &str,

tasks/ast_tools/src/derives/get_span.rs

-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ impl Derive for DeriveGetSpanMut {
120120
}
121121

122122
/// Generate `GetSpan` / `GetSpanMut` trait implementation for a type.
123-
#[expect(clippy::too_many_arguments)]
124123
fn derive_type(
125124
type_def: StructOrEnum,
126125
trait_ident: &Ident,
@@ -149,7 +148,6 @@ fn derive_type(
149148
}
150149

151150
/// Generate `GetSpan` / `GetSpanMut` trait implementation for a struct.
152-
#[expect(clippy::too_many_arguments)]
153151
fn derive_struct(
154152
struct_def: &StructDef,
155153
trait_ident: &Ident,

tasks/ast_tools/src/generators/ast_builder.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ impl Generator for AstBuilderGenerator {
6969
//! AST node factories
7070
7171
//!@@line_break
72-
#![expect(
73-
clippy::default_trait_access,
74-
clippy::too_many_arguments,
75-
clippy::fn_params_excessive_bools,
76-
)]
72+
#![expect(clippy::default_trait_access)]
7773

7874
///@@line_break
7975
use std::cell::Cell;
@@ -192,7 +188,6 @@ fn generate_builder_methods_for_struct(struct_def: &StructDef, schema: &Schema)
192188
/// Build a pair of builder methods for a struct.
193189
///
194190
/// This is a separate function as may need to be called twice, with and without semantic ID fields.
195-
#[expect(clippy::too_many_arguments)]
196191
fn generate_builder_methods_for_struct_impl(
197192
struct_def: &StructDef,
198193
params: &[Param],
@@ -485,7 +480,6 @@ fn generate_builder_method_for_enum_variant(
485480
output2
486481
}
487482

488-
#[expect(clippy::too_many_arguments, clippy::similar_names)]
489483
fn generate_builder_method_for_enum_variant_impl(
490484
enum_def: &EnumDef,
491485
struct_def: &StructDef,

tasks/ast_tools/src/schema/defs/enum.rs

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub struct EnumDef {
4949

5050
impl EnumDef {
5151
/// Create new [`EnumDef`].
52-
#[expect(clippy::too_many_arguments)]
5352
pub fn new(
5453
id: TypeId,
5554
name: String,

tasks/ast_tools/src/schema/defs/struct.rs

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub struct StructDef {
4545

4646
impl StructDef {
4747
/// Create new [`StructDef`].
48-
#[expect(clippy::too_many_arguments)]
4948
pub fn new(
5049
id: TypeId,
5150
name: String,

0 commit comments

Comments
 (0)