Skip to content

Commit 40dcc56

Browse files
authored
Merge pull request #1055 from Yarwin/fix-clippy
Fix clippy: operator precedence can trip the unwary.
2 parents ac8b1da + d7dc404 commit 40dcc56

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

.github/workflows/full-ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103

104104
# Note: could use `-- --no-deps` to not lint dependencies, however it doesn't really speed up and also skips deps in workspace.
105105
- name: "Check clippy"
106+
# TODO(Rust 1.86): remove -A clippy::precedence; see https://github.com/godot-rust/gdext/pull/1055.
106107
run: |
107108
cargo clippy --all-targets $CLIPPY_FEATURES -- \
108109
-D clippy::suspicious \
@@ -112,7 +113,8 @@ jobs:
112113
-D clippy::dbg_macro \
113114
-D clippy::todo \
114115
-D clippy::unimplemented \
115-
-D warnings
116+
-D warnings \
117+
-A clippy::precedence
116118
117119
unit-test:
118120
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})

.github/workflows/minimal-ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
components: clippy
9797

9898
- name: "Check clippy"
99+
# TODO(Rust 1.86): remove -A clippy::precedence; see https://github.com/godot-rust/gdext/pull/1055.
99100
run: |
100101
cargo clippy --all-targets $CLIPPY_FEATURES -- \
101102
-D clippy::suspicious \
@@ -105,7 +106,8 @@ jobs:
105106
-D clippy::dbg_macro \
106107
-D clippy::todo \
107108
-D clippy::unimplemented \
108-
-D warnings
109+
-D warnings \
110+
-A clippy::precedence
109111
110112
111113
unit-test:

.github/workflows/release-version.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ jobs:
133133
-D clippy::dbg_macro \
134134
-D clippy::todo \
135135
-D clippy::unimplemented \
136-
-D warnings
136+
-D warnings \
137+
-A clippy::precedence
137138
138139
rustfmt:
139140
runs-on: ubuntu-latest

check.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ function cmd_fmt() {
146146
}
147147

148148
function cmd_clippy() {
149+
# TODO(Rust 1.86): remove `-A clippy::precedence`.
150+
# In Rust 1.85, `clippy::precedence` includes bitmasking and shift operations. Rigid adherence to this rule results in more noisy code, with
151+
# little benefits (being aware of bit operator precedence is something we can expect + bit manipulations are common in Godot).
152+
# This behavior will be reverted in 1.86 and moved into new lint `precedence_bits` included in `restriction` category.
153+
# See https://github.com/godot-rust/gdext/pull/1055 and https://github.com/rust-lang/rust-clippy/pull/14115.
154+
149155
run cargo clippy --all-targets "${extraCargoArgs[@]}" -- \
150156
-D clippy::suspicious \
151157
-D clippy::style \
@@ -154,7 +160,8 @@ function cmd_clippy() {
154160
-D clippy::dbg_macro \
155161
-D clippy::todo \
156162
-D clippy::unimplemented \
157-
-D warnings
163+
-D warnings \
164+
-A clippy::precedence
158165
}
159166

160167
function cmd_klippy() {

0 commit comments

Comments
 (0)