Skip to content

Commit ee7a6b5

Browse files
authored
Move lints to workspace (#4294)
1 parent 56f7dec commit ee7a6b5

File tree

98 files changed

+446
-325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+446
-325
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
- run: rustup update --no-self-update stable && rustup default stable
6363
- run: rustup target add wasm32-unknown-unknown
6464
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-backend -- -D warnings
65+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen -- -D warnings
6566
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli -- -D warnings
6667
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-cli-support -- -D warnings
6768
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
@@ -89,8 +90,8 @@ jobs:
8990
- uses: actions/checkout@v4
9091
- run: rustup update --no-self-update stable && rustup default stable
9192
- run: rustup target add wasm32-unknown-unknown
92-
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
93-
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings
93+
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys --all-targets -- -D warnings
94+
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys --all-targets -- -D warnings
9495

9596
# Run `cargo clippy` over crates that support `no_std`
9697
clippy_no_std:
@@ -111,7 +112,7 @@ jobs:
111112
name: Clippy `no_std` with `atomics`
112113
runs-on: ubuntu-latest
113114
env:
114-
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory
115+
RUSTFLAGS: -Ctarget-feature=+atomics,+bulk-memory
115116
steps:
116117
- uses: actions/checkout@v4
117118
- 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/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -812,13 +812,3 @@ where
812812
pairs.sort_by_key(|(k, _)| *k);
813813
pairs.into_iter()
814814
}
815-
816-
/// Like `sorted_iter`, but produces mutable references to the values
817-
fn sorted_iter_mut<K, V>(map: &mut HashMap<K, V>) -> impl Iterator<Item = (&K, &mut V)>
818-
where
819-
K: Ord,
820-
{
821-
let mut pairs = map.iter_mut().collect::<Vec<_>>();
822-
pairs.sort_by_key(|(k, _)| *k);
823-
pairs.into_iter()
824-
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ 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+
#[allow(dead_code)]
247248
nargs: usize,
248249
},
249250

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub enum AdapterKind {
4040
instructions: Vec<InstructionData>,
4141
},
4242
Import {
43+
#[allow(dead_code)]
4344
module: String,
4445
name: String,
4546
kind: AdapterJsImportKind,
@@ -139,10 +140,12 @@ pub enum Instruction {
139140
/// Pops a typed integer (`u8`, `s16`, etc.) and pushes a plain Wasm `i32` or `i64` equivalent.
140141
IntToWasm {
141142
input: AdapterType,
143+
#[allow(dead_code)]
142144
output: walrus::ValType,
143145
},
144146
/// Pops a Wasm `i32` or `i64` and pushes a typed integer (`u8`, `s16`, etc.) equivalent.
145147
WasmToInt {
148+
#[allow(dead_code)]
146149
input: walrus::ValType,
147150
output: AdapterType,
148151
},
@@ -166,6 +169,7 @@ pub enum Instruction {
166169

167170
OptionWasmToStringEnum {
168171
name: String,
172+
#[allow(dead_code)]
169173
hole: u32,
170174
},
171175

@@ -310,6 +314,7 @@ pub enum Instruction {
310314
/// pops ptr/length i32, loads string from cache
311315
CachedStringLoad {
312316
owned: bool,
317+
#[allow(dead_code)]
313318
optional: bool,
314319
mem: walrus::MemoryId,
315320
free: walrus::FunctionId,

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"

0 commit comments

Comments
 (0)