Skip to content

Commit e28cf7a

Browse files
committed
Remove coverage feature for edition 2018 compatibility
1 parent 9525fce commit e28cf7a

File tree

12 files changed

+76
-44
lines changed

12 files changed

+76
-44
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ jobs:
6868
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
6969
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings
7070
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
71-
- run: cargo clippy --no-deps --features spans,strict-macro -p wasm-bindgen-macro -- -D warnings
72-
- run: cargo clippy --no-deps --features extra-traits,spans,strict-macro -p wasm-bindgen-macro-support -- -D warnings
71+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings
72+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings
7373
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings
7474
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-shared -- -D warnings
7575
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-test -- -D warnings
76-
- run: cargo clippy --no-deps -p wasm-bindgen-test-macro -- -D warnings
76+
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-test-macro -- -D warnings
7777
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-threads-xform -- -D warnings
7878
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p typescript-tests -- -D warnings
7979
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-conventions -- -D warnings

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* Fixed `js-sys` and `wasm-bindgen-futures` relying on internal paths of `wasm-bindgen` that are not crate feature additive.
99
[#4305](https://github.com/rustwasm/wasm-bindgen/pull/4305)
1010

11+
* Fixed `wasm-bindgen` not being compatible with edition 2018.
12+
[#4306](https://github.com/rustwasm/wasm-bindgen/pull/4306)
13+
1114
--------------------------------------------------------------------------------
1215

1316
## [0.2.96](https://github.com/rustwasm/wasm-bindgen/compare/0.2.95...0.2.96)

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-featu
5252
"atomics",
5353
] }
5454

55-
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), wasm_bindgen_unstable_test_coverage))'.dependencies]
56-
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.96", default-features = false, features = [
57-
"coverage",
58-
] }
5955

6056
[dev-dependencies]
6157
wasm-bindgen-test = { path = 'crates/test' }

crates/backend/Cargo.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ version = "0.2.96"
1515

1616
[features]
1717
atomics = []
18-
coverage = []
1918
default = ["std"]
2019
extra-traits = ["syn/extra-traits"]
2120
spans = []
@@ -30,5 +29,12 @@ quote = '1.0'
3029
syn = { version = '2.0', features = ['full'] }
3130
wasm-bindgen-shared = { path = "../shared", version = "=0.2.96" }
3231

33-
[lints]
34-
workspace = true
32+
[lints.rust]
33+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }
34+
35+
[lints.clippy]
36+
large_enum_variant = "allow"
37+
new_without_default = "allow"
38+
overly_complex_bool_expr = "allow"
39+
too_many_arguments = "allow"
40+
type_complexity = "allow"

crates/backend/src/codegen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,8 +1966,8 @@ fn respan(input: TokenStream, span: &dyn ToTokens) -> TokenStream {
19661966
}
19671967

19681968
fn coverage() -> Option<TokenStream> {
1969-
#[cfg(feature = "coverage")]
1969+
#[cfg(wasm_bindgen_unstable_test_coverage)]
19701970
return Some(quote! { #[coverage(off)] });
1971-
#[cfg(not(feature = "coverage"))]
1971+
#[cfg(not(wasm_bindgen_unstable_test_coverage))]
19721972
None
19731973
}

crates/macro-support/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ version = "0.2.96"
1515

1616
[features]
1717
atomics = ["wasm-bindgen-backend/atomics"]
18-
coverage = ["wasm-bindgen-backend/coverage"]
1918
default = ["std"]
2019
extra-traits = ["syn/extra-traits"]
2120
spans = ["wasm-bindgen-backend/spans"]

crates/macro/Cargo.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ proc-macro = true
1818

1919
[features]
2020
atomics = ["wasm-bindgen-macro-support/atomics"]
21-
coverage = ["wasm-bindgen-macro-support/coverage"]
2221
default = ["std"]
2322
spans = ["wasm-bindgen-macro-support/spans"]
2423
std = ["wasm-bindgen-macro-support/std"]
@@ -36,5 +35,12 @@ wasm-bindgen = { path = "../.." }
3635
wasm-bindgen-futures = { path = "../futures" }
3736
web-sys = { path = "../web-sys", features = ["Worker"] }
3837

39-
[lints]
40-
workspace = true
38+
[lints.rust]
39+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }
40+
41+
[lints.clippy]
42+
large_enum_variant = "allow"
43+
new_without_default = "allow"
44+
overly_complex_bool_expr = "allow"
45+
too_many_arguments = "allow"
46+
type_complexity = "allow"

crates/macro/src/lib.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")]
22
#![cfg_attr(
3-
any(feature = "coverage", all(not(feature = "std"), feature = "atomics")),
3+
any(
4+
wasm_bindgen_unstable_test_coverage,
5+
all(not(feature = "std"), feature = "atomics")
6+
),
47
feature(allow_internal_unstable),
58
allow(internal_features)
69
)]
@@ -11,7 +14,10 @@ use proc_macro::TokenStream;
1114
use quote::quote;
1215

1316
#[proc_macro_attribute]
14-
#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))]
17+
#[cfg_attr(
18+
wasm_bindgen_unstable_test_coverage,
19+
allow_internal_unstable(coverage_attribute)
20+
)]
1521
#[cfg_attr(
1622
all(not(feature = "std"), feature = "atomics"),
1723
allow_internal_unstable(thread_local)
@@ -42,7 +48,10 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream {
4248
/// let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js"));
4349
/// ```
4450
#[proc_macro]
45-
#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))]
51+
#[cfg_attr(
52+
wasm_bindgen_unstable_test_coverage,
53+
allow_internal_unstable(coverage_attribute)
54+
)]
4655
pub fn link_to(input: TokenStream) -> TokenStream {
4756
match wasm_bindgen_macro_support::expand_link_to(input.into()) {
4857
Ok(tokens) => {
@@ -59,7 +68,10 @@ pub fn link_to(input: TokenStream) -> TokenStream {
5968
}
6069

6170
#[proc_macro_attribute]
62-
#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))]
71+
#[cfg_attr(
72+
wasm_bindgen_unstable_test_coverage,
73+
allow_internal_unstable(coverage_attribute)
74+
)]
6375
pub fn __wasm_bindgen_class_marker(attr: TokenStream, input: TokenStream) -> TokenStream {
6476
match wasm_bindgen_macro_support::expand_class_marker(attr.into(), input.into()) {
6577
Ok(tokens) => {

crates/test-macro/Cargo.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ version = "0.3.46"
1212
[lib]
1313
proc-macro = true
1414

15-
[features]
16-
coverage = []
17-
1815
[dependencies]
1916
proc-macro2 = "1.0"
2017
quote = "1.0"
@@ -30,5 +27,12 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
3027
trybuild = "1.0"
3128
wasm-bindgen-test = { path = "../test" }
3229

33-
[lints]
34-
workspace = true
30+
[lints.rust]
31+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)'] }
32+
33+
[lints.clippy]
34+
large_enum_variant = "allow"
35+
new_without_default = "allow"
36+
overly_complex_bool_expr = "allow"
37+
too_many_arguments = "allow"
38+
type_complexity = "allow"

crates/test-macro/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! going on here.
33
44
#![cfg_attr(
5-
feature = "coverage",
5+
wasm_bindgen_unstable_test_coverage,
66
feature(allow_internal_unstable),
77
allow(internal_features)
88
)]
@@ -18,7 +18,10 @@ use std::sync::atomic::*;
1818
static CNT: AtomicUsize = AtomicUsize::new(0);
1919

2020
#[proc_macro_attribute]
21-
#[cfg_attr(feature = "coverage", allow_internal_unstable(coverage_attribute))]
21+
#[cfg_attr(
22+
wasm_bindgen_unstable_test_coverage,
23+
allow_internal_unstable(coverage_attribute)
24+
)]
2225
pub fn wasm_bindgen_test(
2326
attr: proc_macro::TokenStream,
2427
body: proc_macro::TokenStream,
@@ -106,17 +109,12 @@ pub fn wasm_bindgen_test(
106109
// main test harness. This is the entry point for all tests.
107110
let name = format_ident!("__wbgt_{}_{}", ident, CNT.fetch_add(1, Ordering::SeqCst));
108111
let wasm_bindgen_path = attributes.wasm_bindgen_path;
109-
let coverage = if cfg!(feature = "coverage") {
110-
Some(quote! { #[coverage(off)] })
111-
} else {
112-
None
113-
};
114112
tokens.extend(
115113
quote! {
116114
const _: () = {
117115
#[no_mangle]
118116
#[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))]
119-
#coverage
117+
#[cfg_attr(wasm_bindgen_unstable_test_coverage, coverage(off))]
120118
pub extern "C" fn #name(cx: &#wasm_bindgen_path::__rt::Context) {
121119
let test_name = ::core::concat!(::core::module_path!(), "::", ::core::stringify!(#ident));
122120
#test_body

0 commit comments

Comments
 (0)