Skip to content

Commit 1c658f7

Browse files
Add clippy to CI (as non blocking warnings) (#19)
1 parent 62bd72c commit 1c658f7

File tree

5 files changed

+129
-6
lines changed

5 files changed

+129
-6
lines changed

.github/workflows/ci.yml

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
env:
22
RUST_STABLE_VER: "1.87"
3-
3+
44
name: CI
55

66
on:
@@ -23,9 +23,83 @@ jobs:
2323
toolchain: ${{ env.RUST_STABLE_VER }}
2424
components: rustfmt
2525

26-
# For now, we only check `fearless_simd_gen`, since `fearless_simd` uses `prettyplease`.
2726
- name: cargo fmt
28-
run: cd fearless_simd_gen && cargo fmt --check
27+
run: cargo fmt --all --check
28+
29+
clippy-stable:
30+
name: cargo clippy
31+
runs-on: ${{ matrix.os }}
32+
strategy:
33+
matrix:
34+
os: [windows-latest, macos-latest, ubuntu-latest]
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: install stable toolchain
39+
uses: dtolnay/rust-toolchain@master
40+
with:
41+
toolchain: ${{ env.RUST_STABLE_VER }}
42+
targets: x86_64-unknown-none
43+
components: clippy
44+
45+
- name: install cargo-hack
46+
uses: taiki-e/install-action@v2
47+
with:
48+
tool: cargo-hack
49+
50+
- name: install native dependencies
51+
if: matrix.os == 'ubuntu-latest'
52+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
53+
54+
- name: restore cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
save-if: ${{ github.event_name != 'merge_group' }}
58+
59+
# TODO: Add back the suffix ` -- -D warnings` onto this command to make warnings errors.
60+
# Currently there are too many warnings to turn on this lint.
61+
- name: cargo clippy (no_std)
62+
run: cargo hack clippy -p fearless_simd --locked --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features std,default,half --target x86_64-unknown-none
63+
64+
# TODO: Add back the suffix ` -- -D warnings` onto this command to make warnings errors.
65+
# Currently there are too many warnings to turn on this lint.
66+
- name: cargo clippy
67+
run: cargo hack clippy --workspace --locked --optional-deps --each-feature --ignore-unknown-features --features std
68+
69+
70+
clippy-stable-wasm:
71+
name: cargo clippy (wasm32)
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: install stable toolchain
77+
uses: dtolnay/rust-toolchain@master
78+
with:
79+
toolchain: ${{ env.RUST_STABLE_VER }}
80+
targets: wasm32-unknown-unknown
81+
components: clippy
82+
83+
- name: install cargo-hack
84+
uses: taiki-e/install-action@v2
85+
with:
86+
tool: cargo-hack
87+
88+
- name: restore cache
89+
uses: Swatinem/rust-cache@v2
90+
with:
91+
save-if: ${{ github.event_name != 'merge_group' }}
92+
93+
# TODO: Add back the suffix ` -- -D warnings` onto this command to make warnings errors.
94+
# Currently there are too many warnings to turn on this lint.
95+
- name: cargo clippy (no_std)
96+
run: cargo hack clippy -p fearless_simd --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features libm --exclude-features std,default,half
97+
98+
# TODO: Add back the suffix ` -- -D warnings` onto this command to make warnings errors.
99+
# Currently there are too many warnings to turn on this lint.
100+
- name: cargo clippy
101+
run: cargo hack clippy -p fearless_simd --locked --target wasm32-unknown-unknown --optional-deps --each-feature --ignore-unknown-features --features std
102+
29103

30104
test-stable:
31105
name: test
@@ -94,4 +168,5 @@ jobs:
94168

95169
- name: cargo build
96170
run: cd fearless_simd && cargo build --no-default-features --features libm
171+
97172

Cargo.toml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,54 @@ members = ["fearless_simd", "fearless_simd_gen", "fearless_simd_tests"]
66
license = "MIT/Apache-2.0"
77
edition = "2024"
88

9+
10+
[workspace.lints]
11+
12+
# LINEBENDER LINT SET - Cargo.toml - v5
13+
# See https://linebender.org/wiki/canonical-lints/
14+
rust.keyword_idents_2024 = "forbid"
15+
rust.non_ascii_idents = "forbid"
16+
rust.non_local_definitions = "forbid"
17+
rust.unsafe_op_in_unsafe_fn = "forbid"
18+
19+
rust.elided_lifetimes_in_paths = "warn"
20+
rust.missing_debug_implementations = "warn"
21+
rust.missing_docs = "warn"
22+
rust.trivial_numeric_casts = "warn"
23+
rust.unexpected_cfgs = "warn"
24+
rust.unnameable_types = "warn"
25+
rust.unreachable_pub = "warn"
26+
rust.unused_import_braces = "warn"
27+
rust.unused_lifetimes = "warn"
28+
rust.unused_macro_rules = "warn"
29+
30+
clippy.too_many_arguments = "allow"
31+
32+
clippy.allow_attributes_without_reason = "warn"
33+
clippy.cast_possible_truncation = "warn"
34+
clippy.collection_is_never_read = "warn"
35+
clippy.dbg_macro = "warn"
36+
clippy.debug_assert_with_mut_call = "warn"
37+
clippy.doc_markdown = "warn"
38+
clippy.fn_to_numeric_cast_any = "warn"
39+
clippy.infinite_loop = "warn"
40+
clippy.large_stack_arrays = "warn"
41+
clippy.mismatching_type_param_order = "warn"
42+
clippy.missing_assert_message = "warn"
43+
clippy.missing_fields_in_debug = "warn"
44+
clippy.same_functions_in_if_condition = "warn"
45+
clippy.semicolon_if_nothing_returned = "warn"
46+
clippy.shadow_unrelated = "warn"
47+
clippy.should_panic_without_expect = "warn"
48+
clippy.todo = "warn"
49+
clippy.unseparated_literal_suffix = "warn"
50+
clippy.use_self = "warn"
51+
52+
clippy.cargo_common_metadata = "warn"
53+
clippy.negative_feature_names = "warn"
54+
clippy.redundant_feature_names = "warn"
55+
clippy.wildcard_dependencies = "warn"
56+
# END LINEBENDER LINT SET
57+
958
[workspace.dependencies]
1059
fearless_simd = { path = "fearless_simd" }

fearless_simd/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ std = []
1717
libm = ["dep:libm"]
1818

1919
[dependencies]
20-
bytemuck = "1.23.1"
20+
bytemuck = "1.23.0"
2121
libm = { version = "0.2.15", optional = true }
2222
half = { version = "2.4.1", optional = true }

fearless_simd/src/impl_macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ macro_rules! delegate {
1717
) $(-> $ret: ty)?;
1818
)*) => {
1919
$(
20+
#[allow(clippy::not_unsafe_ptr_arg_deref)]
2021
#[doc=concat!("See [`", stringify!($prefix), "::", stringify!($func), "`].")]
2122
$(#[$attr])*
2223
#[inline(always)]

fearless_simd/src/macros.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ macro_rules! simd_dispatch {
2222
#[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
2323
#[inline]
2424
unsafe fn inner_wasm_simd128(simd128: $crate::wasm32::WasmSimd128 $( , $arg: $ty )* ) $( -> $ret )? {
25-
println!("GOT IN HERE WHAT THE!");
2625
$inner( simd128 $( , $arg )* )
2726
}
2827
match level {
2928
Level::Fallback(fb) => {
30-
println!("fallback dispatched");
3129
$inner(fb $( , $arg )* )
3230
},
3331
#[cfg(target_arch = "aarch64")]

0 commit comments

Comments
 (0)