Skip to content

Commit ddb3152

Browse files
committed
Move lints to workspace
1 parent 56f7dec commit ddb3152

File tree

34 files changed

+110
-48
lines changed

34 files changed

+110
-48
lines changed

.cargo/config.toml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,2 @@
11
[target.'cfg(target_arch = "wasm32")']
22
runner = 'cargo run -p wasm-bindgen-cli --bin wasm-bindgen-test-runner --'
3-
4-
[target.'cfg(all())']
5-
rustflags = [
6-
"-Adead_code",
7-
"-Anon_upper_case_globals",
8-
"-Aunused_doc_comments",
9-
"-Aclippy::large_enum_variant",
10-
"-Aclippy::missing_safety_doc",
11-
"-Aclippy::new_without_default",
12-
"-Aclippy::overly_complex_bool_expr",
13-
"-Aclippy::too_many_arguments",
14-
"-Aclippy::type_complexity",
15-
]

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
name: Clippy `no_std` with `atomics`
112112
runs-on: ubuntu-latest
113113
env:
114-
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory
114+
RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory
115115
steps:
116116
- uses: actions/checkout@v4
117117
- run: rustup default nightly-2024-07-06

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ wasm-bindgen-test-crate-b = { path = 'tests/crates/b' }
7070
[lints.rust]
7171
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }
7272

73+
[lints.clippy]
74+
large_enum_variant = "allow"
75+
new_without_default = "allow"
76+
overly_complex_bool_expr = "allow"
77+
too_many_arguments = "allow"
78+
type_complexity = "allow"
79+
80+
[workspace.lints.clippy]
81+
large_enum_variant = "allow"
82+
new_without_default = "allow"
83+
overly_complex_bool_expr = "allow"
84+
too_many_arguments = "allow"
85+
type_complexity = "allow"
86+
7387
[workspace]
7488
exclude = ["crates/msrv"]
7589
members = [

crates/backend/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ proc-macro2 = "1.0"
2929
quote = '1.0'
3030
syn = { version = '2.0', features = ['full'] }
3131
wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" }
32+
33+
[lints]
34+
workspace = true

crates/cli-support/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ wasm-bindgen-shared = { path = "../shared", version = '=0.2.95' }
2929
wasm-bindgen-threads-xform = { path = '../threads-xform', version = '=0.2.95' }
3030
wasm-bindgen-wasm-conventions = { path = '../wasm-conventions', version = '=0.2.95' }
3131
wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.95' }
32+
33+
[lints]
34+
workspace = true

crates/cli-support/src/js/binding.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,6 @@ fn instruction(
12401240

12411241
Instruction::CachedStringLoad {
12421242
owned,
1243-
optional: _,
12441243
mem,
12451244
free,
12461245
table,

crates/cli-support/src/js/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,6 @@ __wbg_set_wasm(wasm);"
32743274
dtor,
32753275
mutable,
32763276
adapter,
3277-
nargs: _,
32783277
} => {
32793278
assert!(kind == AdapterJsImportKind::Normal);
32803279
assert!(!variadic);

crates/cli-support/src/wit/incoming.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ impl InstructionBuilder<'_, '_> {
117117
&[AdapterType::Enum(name.clone())],
118118
Instruction::IntToWasm {
119119
input: AdapterType::U32,
120-
output: ValType::I32,
121120
},
122121
&[AdapterType::I32],
123122
);
@@ -473,7 +472,6 @@ impl InstructionBuilder<'_, '_> {
473472
fn number(&mut self, input: AdapterType, output: walrus::ValType) {
474473
let instr = Instruction::IntToWasm {
475474
input: input.clone(),
476-
output,
477475
};
478476
self.instruction(&[input], instr, &[AdapterType::from_wasm(output).unwrap()]);
479477
}

crates/cli-support/src/wit/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ impl<'a> Context<'a> {
197197
// aren't present in the signature but are present in the wasm
198198
// signature.
199199
let mut function = descriptor.function.clone();
200-
let nargs = function.arguments.len();
201200
function.arguments.insert(0, Descriptor::I32);
202201
function.arguments.insert(0, Descriptor::I32);
203202
let adapter = self.table_element_adapter(descriptor.shim_idx, function)?;
@@ -206,7 +205,6 @@ impl<'a> Context<'a> {
206205
AuxImport::Closure {
207206
dtor: descriptor.dtor_idx,
208207
mutable: descriptor.mutable,
209-
nargs,
210208
adapter,
211209
},
212210
);
@@ -1204,7 +1202,7 @@ impl<'a> Context<'a> {
12041202
kind: AdapterJsImportKind,
12051203
) -> Result<AdapterId, Error> {
12061204
let import = self.module.imports.get(import);
1207-
let (import_module, import_name) = (import.module.clone(), import.name.clone());
1205+
let import_name = import.name.clone();
12081206
let import_id = import.id();
12091207
let core_id = match import.kind {
12101208
walrus::ImportKind::Function(f) => f,
@@ -1241,7 +1239,6 @@ impl<'a> Context<'a> {
12411239
ret.input,
12421240
vec![],
12431241
AdapterKind::Import {
1244-
module: import_module,
12451242
name: import_name,
12461243
kind,
12471244
},

crates/cli-support/src/wit/nonstandard.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ pub enum AuxImport {
244244
mutable: bool, // whether or not this was a `FnMut` closure
245245
dtor: u32, // table element index of the destructor function
246246
adapter: AdapterId, // the adapter which translates the types for this closure
247-
nargs: usize,
248247
},
249248

250249
/// This import is expected to be a shim that simply calls the `foo` method

crates/cli-support/src/wit/outgoing.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl InstructionBuilder<'_, '_> {
110110
Descriptor::Ref(d) => self.outgoing_ref(false, d)?,
111111
Descriptor::RefMut(d) => self.outgoing_ref(true, d)?,
112112

113-
Descriptor::CachedString => self.cached_string(false, true)?,
113+
Descriptor::CachedString => self.cached_string(false)?,
114114

115115
Descriptor::String => {
116116
// fetch the ptr/length ...
@@ -193,7 +193,7 @@ impl InstructionBuilder<'_, '_> {
193193
&[AdapterType::NamedExternref(name.clone())],
194194
);
195195
}
196-
Descriptor::CachedString => self.cached_string(false, false)?,
196+
Descriptor::CachedString => self.cached_string(false)?,
197197

198198
Descriptor::String => {
199199
self.instruction(
@@ -316,13 +316,10 @@ impl InstructionBuilder<'_, '_> {
316316
&[AdapterType::Enum(name.clone()).option()],
317317
);
318318
}
319-
Descriptor::StringEnum { name, hole, .. } => {
319+
Descriptor::StringEnum { name, .. } => {
320320
self.instruction(
321321
&[AdapterType::I32],
322-
Instruction::OptionWasmToStringEnum {
323-
name: name.clone(),
324-
hole: *hole,
325-
},
322+
Instruction::OptionWasmToStringEnum { name: name.clone() },
326323
&[AdapterType::StringEnum(name.clone()).option()],
327324
);
328325
}
@@ -338,7 +335,7 @@ impl InstructionBuilder<'_, '_> {
338335
Descriptor::Ref(d) => self.outgoing_option_ref(false, d)?,
339336
Descriptor::RefMut(d) => self.outgoing_option_ref(true, d)?,
340337

341-
Descriptor::CachedString => self.cached_string(true, true)?,
338+
Descriptor::CachedString => self.cached_string(true)?,
342339

343340
Descriptor::String | Descriptor::Vector(_) => {
344341
let kind = arg.vector_kind().ok_or_else(|| {
@@ -528,7 +525,7 @@ impl InstructionBuilder<'_, '_> {
528525
&[AdapterType::NamedExternref(name.clone()).option()],
529526
);
530527
}
531-
Descriptor::CachedString => self.cached_string(true, false)?,
528+
Descriptor::CachedString => self.cached_string(true)?,
532529
Descriptor::String | Descriptor::Slice(_) => {
533530
let kind = arg.vector_kind().ok_or_else(|| {
534531
format_err!(
@@ -556,7 +553,6 @@ impl InstructionBuilder<'_, '_> {
556553

557554
fn outgoing_i32(&mut self, output: AdapterType) {
558555
let instr = Instruction::WasmToInt {
559-
input: walrus::ValType::I32,
560556
output: output.clone(),
561557
};
562558
self.instruction(&[AdapterType::I32], instr, &[output]);
@@ -574,20 +570,18 @@ impl InstructionBuilder<'_, '_> {
574570

575571
fn outgoing_i64(&mut self, output: AdapterType) {
576572
let instr = Instruction::WasmToInt {
577-
input: walrus::ValType::I64,
578573
output: output.clone(),
579574
};
580575
self.instruction(&[AdapterType::I64], instr, &[output]);
581576
}
582577

583-
fn cached_string(&mut self, optional: bool, owned: bool) -> Result<(), Error> {
578+
fn cached_string(&mut self, owned: bool) -> Result<(), Error> {
584579
let mem = self.cx.memory()?;
585580
let free = self.cx.free()?;
586581
self.instruction(
587582
&[AdapterType::I32, AdapterType::I32],
588583
Instruction::CachedStringLoad {
589584
owned,
590-
optional,
591585
mem,
592586
free,
593587
table: None,

crates/cli-support/src/wit/standard.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub enum AdapterKind {
4040
instructions: Vec<InstructionData>,
4141
},
4242
Import {
43-
module: String,
4443
name: String,
4544
kind: AdapterJsImportKind,
4645
},
@@ -139,11 +138,9 @@ pub enum Instruction {
139138
/// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain Wasm `i32` or `i64` equivalent.
140139
IntToWasm {
141140
input: AdapterType,
142-
output: walrus::ValType,
143141
},
144142
/// Pops a Wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent.
145143
WasmToInt {
146-
input: walrus::ValType,
147144
output: AdapterType,
148145
},
149146

@@ -166,7 +163,6 @@ pub enum Instruction {
166163

167164
OptionWasmToStringEnum {
168165
name: String,
169-
hole: u32,
170166
},
171167

172168
/// pops a string and pushes the enum variant as an `i32`
@@ -310,7 +306,6 @@ pub enum Instruction {
310306
/// pops ptr/length i32, loads string from cache
311307
CachedStringLoad {
312308
owned: bool,
313-
optional: bool,
314309
mem: walrus::MemoryId,
315310
free: walrus::FunctionId,
316311
/// If we're in reference-types mode, the externref table ID to get the cached string from.

crates/cli/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ rustls-tls = ["ureq/tls"]
5757
# Legacy support
5858
openssl = ["dep:native-tls"]
5959
vendored-openssl = ["openssl", "native-tls/vendored"]
60+
61+
[lints]
62+
workspace = true

crates/externref-xform/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ wasmprinter = "0.214"
2424
wast = "214"
2525
wat = "1.0"
2626

27+
[lints]
28+
workspace = true
29+
2730
[[test]]
2831
harness = false
2932
name = "all"

crates/futures/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ version = "=0.3.72"
3838
futures-channel-preview = { version = "0.3.0-alpha.18" }
3939
futures-lite = { version = "1.11.3", default-features = false }
4040
wasm-bindgen-test = { path = '../test' }
41+
42+
[lints]
43+
workspace = true

crates/js-sys/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ web-sys = { path = "../web-sys", features = ["Headers", "Response", "ResponseIni
3434

3535
[lints.rust]
3636
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(js_sys_unstable_apis)'] }
37+
38+
[lints.clippy]
39+
large_enum_variant = "allow"
40+
new_without_default = "allow"
41+
overly_complex_bool_expr = "allow"
42+
too_many_arguments = "allow"
43+
type_complexity = "allow"

crates/macro-support/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ quote = '1.0'
2828
syn = { version = '2.0', features = ['visit', 'visit-mut', 'full'] }
2929
wasm-bindgen-backend = { path = "../backend", version = "=0.2.95", default-features = false }
3030
wasm-bindgen-shared = { path = "../shared", version = "=0.2.95" }
31+
32+
[lints]
33+
workspace = true

crates/macro/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ trybuild = "1.0"
3535
wasm-bindgen = { path = "../.." }
3636
wasm-bindgen-futures = { path = "../futures" }
3737
web-sys = { path = "../web-sys", features = ["Worker"] }
38+
39+
[lints]
40+
workspace = true

crates/multi-value-xform/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ wasmprinter = "0.214"
2424
wast = "214"
2525
wat = "1.0"
2626

27+
[lints]
28+
workspace = true
29+
2730
[[test]]
2831
harness = false
2932
name = "all"

crates/shared/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ version = "0.2.95"
1818
# graph, pretend we link a native library so that `cargo` will provide better
1919
# error messages than the esoteric linker errors we would otherwise trigger.
2020
links = "wasm_bindgen"
21+
22+
[lints]
23+
workspace = true

crates/test-macro/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ syn = { version = "2.0", default-features = false, features = [
2929
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
3030
trybuild = "1.0"
3131
wasm-bindgen-test = { path = "../test" }
32+
33+
[lints]
34+
workspace = true

crates/test/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@ wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.3.45', feature
2929
[lints.rust]
3030
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }
3131

32+
[lints.clippy]
33+
large_enum_variant = "allow"
34+
new_without_default = "allow"
35+
overly_complex_bool_expr = "allow"
36+
too_many_arguments = "allow"
37+
type_complexity = "allow"
38+
3239
[lib]
3340
test = false

crates/threads-xform/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ wasmparser = "0.214"
2424
wasmprinter = "0.214"
2525
wat = "1.0"
2626

27+
[lints]
28+
workspace = true
29+
2730
[[test]]
2831
harness = false
2932
name = "all"

crates/typescript-tests/src/custom_section.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const TS_INTERFACE_EXPORT: &'static str = r"
88
#[wasm_bindgen(typescript_custom_section)]
99
const TS_INTERFACE_EXPORT1: &'static str = include_str!("./custom_section_types.d.ts");
1010

11+
#[allow(dead_code)]
1112
const TS_INTERFACE_EXPORT2: &str = "interface Person2 { height: number; }";
1213
#[wasm_bindgen(typescript_custom_section)]
1314
const _: &str = TS_INTERFACE_EXPORT2;

crates/typescript-tests/src/simple_struct.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub struct A {}
66
#[wasm_bindgen]
77
impl A {
88
#[wasm_bindgen(constructor)]
9+
#[allow(clippy::new_without_default)]
910
pub fn new() -> A {
1011
A {}
1112
}

crates/wasm-conventions/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ walrus = "0.23"
1818
anyhow = "1.0"
1919
log = "0.4"
2020
wasmparser = "0.212"
21+
22+
[lints]
23+
workspace = true

crates/wasm-interpreter/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ wasm-bindgen-wasm-conventions = { path = "../wasm-conventions", version = "0.2.9
2222
[dev-dependencies]
2323
tempfile = "3"
2424
wat = "1.0"
25+
26+
[lints]
27+
workspace = true

crates/web-sys/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ wasm-bindgen-test = { path = '../test' }
3434
[lints.rust]
3535
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] }
3636

37+
[lints.clippy]
38+
large_enum_variant = "allow"
39+
new_without_default = "allow"
40+
overly_complex_bool_expr = "allow"
41+
too_many_arguments = "allow"
42+
type_complexity = "allow"
43+
3744
# This list is auto-generated by the wasm-bindgen-webidl program
3845
[features]
3946
default = ["std"]

crates/webidl/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ sourcefile = "0.2"
1919
syn = { version = '2.0', features = ['extra-traits', 'full'] }
2020
wasm-bindgen-backend = { path = "../backend" }
2121
weedle = { git = "https://github.com/rustwasm/weedle.git" }
22+
23+
[lints]
24+
workspace = true

0 commit comments

Comments
 (0)