1212 # List of packages that will be checked with the minimum supported Rust version.
1313 # This should be limited to packages that are intended for publishing.
1414 RUST_MIN_VER_PKGS : " -p svgtypes"
15+ # List of features that depend on the standard library and will be excluded from no_std checks.
16+ FEATURES_DEPENDING_ON_STD : " std,default"
1517
1618
1719# Rationale
3941# The MSRV jobs run only cargo check because different clippy versions can disagree on goals and
4042# running tests introduces dev dependencies which may require a higher MSRV than the bare package.
4143#
44+ # For no_std checks we target x86_64-unknown-none, because this target doesn't support std
45+ # and as such will error out if our dependency tree accidentally tries to use std.
46+ # https://doc.rust-lang.org/stable/rustc/platform-support/x86_64-unknown-none.html
47+ #
4248# We don't save caches in the merge-group cases, because those caches will never be re-used (apart
4349# from the very rare cases where there are multiple PRs in the merge queue).
4450# This is because GitHub doesn't share caches between merge queues and the main branch.
@@ -105,11 +111,14 @@ jobs:
105111 with :
106112 save-if : ${{ github.event_name != 'merge_group' }}
107113
114+ - name : cargo clippy (no_std)
115+ run : cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} --target x86_64-unknown-none -- -D warnings
116+
108117 - name : cargo clippy
109- run : cargo hack clippy --workspace --locked --optional-deps --each-feature -- -D warnings
118+ run : cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features std -- -D warnings
110119
111120 - name : cargo clippy (auxiliary)
112- run : cargo hack clippy --workspace --locked --optional-deps --each-feature --tests --examples -- -D warnings
121+ run : cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features std -- tests --examples -- -D warnings
113122
114123 clippy-stable-wasm :
115124 name : cargo clippy (wasm32)
@@ -135,10 +144,10 @@ jobs:
135144 save-if : ${{ github.event_name != 'merge_group' }}
136145
137146 - name : cargo clippy
138- run : cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --optional-deps --each-feature -- -D warnings
147+ run : cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std -- -D warnings
139148
140149 - name : cargo clippy (auxiliary)
141- run : cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --optional-deps --each-feature --tests --examples -- -D warnings
150+ run : cargo hack clippy --workspace --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std -- tests --examples -- -D warnings
142151
143152 test-stable :
144153 name : cargo test
@@ -216,8 +225,11 @@ jobs:
216225 with :
217226 save-if : ${{ github.event_name != 'merge_group' }}
218227
228+ - name : cargo check (no_std)
229+ run : cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features ${{ env.FEATURES_DEPENDING_ON_STD }} --target x86_64-unknown-none
230+
219231 - name : cargo check
220- run : cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature
232+ run : cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --optional-deps --each-feature --ignore-unknown-features --features std
221233
222234 check-msrv-wasm :
223235 name : cargo check (msrv) (wasm32)
@@ -242,7 +254,7 @@ jobs:
242254 save-if : ${{ github.event_name != 'merge_group' }}
243255
244256 - name : cargo check
245- run : cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature
257+ run : cargo hack check ${{ env.RUST_MIN_VER_PKGS }} --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std
246258
247259 doc :
248260 name : cargo doc
0 commit comments