diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6e92dae0..045a6bb9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -245,33 +245,33 @@ jobs: - name: Test (Node) env: RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: wasm-pack test --node + run: wasm-pack test --node -- --features std - name: Test (Firefox) env: WASM_BINDGEN_USE_BROWSER: 1 RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: wasm-pack test --headless --firefox + run: wasm-pack test --headless --firefox -- --features std - name: Test (Chrome) env: WASM_BINDGEN_USE_BROWSER: 1 RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: wasm-pack test --headless --chrome + run: wasm-pack test --headless --chrome -- --features std - name: Test (dedicated worker) env: WASM_BINDGEN_USE_DEDICATED_WORKER: 1 RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: wasm-pack test --headless --firefox + run: wasm-pack test --headless --firefox -- --features std - name: Test (shared worker) env: WASM_BINDGEN_USE_SHARED_WORKER: 1 RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: wasm-pack test --headless --firefox + run: wasm-pack test --headless --firefox -- --features std - name: Test (service worker) env: WASM_BINDGEN_USE_SERVICE_WORKER: 1 RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" # Firefox doesn't support module service workers and therefor can't import scripts - run: wasm-pack test --headless --chrome + run: wasm-pack test --headless --chrome -- --features std wasi: name: WASI diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 2653984d..ce440db9 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -23,7 +23,7 @@ jobs: # Fixed Nigthly version is used to prevent # CI failures which are not relevant to PR changes # on introduction of new Clippy lints. - toolchain: nightly-2024-10-08 + toolchain: nightly-2024-10-24 components: clippy,rust-src - name: std feature run: cargo clippy --features std @@ -48,7 +48,23 @@ jobs: - name: Web WASM (wasm_js.rs) env: RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" - run: cargo clippy -Zbuild-std --target wasm32-unknown-unknown + run: cargo clippy --features std -Zbuild-std=panic_abort,std --target wasm32-unknown-unknown + - name: Web WASM no_std (wasm_js.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" + run: cargo clippy -Zbuild-std=core,alloc --target wasm32-unknown-unknown + - name: Web WASM no_std with atomics (wasm_js.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" -Ctarget-feature=+atomics,+bulk-memory + run: cargo clippy -Zbuild-std=core,alloc --target wasm32-unknown-unknown + - name: Web WASMv1 (wasm_js.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" + run: cargo clippy -Zbuild-std=core,alloc --target wasm32v1-none + - name: Web WASMv1 with atomics (wasm_js.rs) + env: + RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" -Ctarget-feature=+atomics,+bulk-memory + run: cargo clippy -Zbuild-std=core,alloc --target wasm32v1-none - name: Linux (linux_android.rs) env: RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom" diff --git a/Cargo.toml b/Cargo.toml index 875a7fd0..1f6a34bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,14 +65,14 @@ windows-targets = "0.52" # wasm_js [target.'cfg(all(getrandom_backend = "wasm_js", target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies] wasm-bindgen = { version = "0.2.96", default-features = false } -js-sys = "0.3.73" +js-sys = { version = "0.3.73", default-features = false } [target.'cfg(all(getrandom_backend = "wasm_js", target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dev-dependencies] wasm-bindgen-test = "0.3" [features] # Implement std::error::Error for getrandom::Error and # use std to retrieve OS error descriptions -std = [] +std = ["wasm-bindgen/std", "js-sys/std"] # Unstable feature to support being a libstd dependency rustc-dep-of-std = ["compiler_builtins", "core"]