Skip to content

Commit f547a6e

Browse files
authored
Merge pull request #1115 from Yarwin/apply-clippy-lints-after-rust-1-86
post `Rust 1.86` update: apply clippy lints
2 parents a752851 + 5486086 commit f547a6e

File tree

8 files changed

+12
-28
lines changed

8 files changed

+12
-28
lines changed

.github/workflows/full-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ jobs:
104104

105105
# Note: could use `-- --no-deps` to not lint dependencies, however it doesn't really speed up and also skips deps in workspace.
106106
- name: "Check clippy"
107-
# TODO(Rust 1.86): remove -A clippy::precedence; see https://github.com/godot-rust/gdext/pull/1055.
108107
run: |
109108
cargo clippy --all-targets $CLIPPY_FEATURES -- \
110109
-D clippy::suspicious \
@@ -114,8 +113,7 @@ jobs:
114113
-D clippy::dbg_macro \
115114
-D clippy::todo \
116115
-D clippy::unimplemented \
117-
-D warnings \
118-
-A clippy::precedence
116+
-D warnings
119117
120118
unit-test:
121119
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})

.github/workflows/minimal-ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ 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.
10099
run: |
101100
cargo clippy --all-targets $CLIPPY_FEATURES -- \
102101
-D clippy::suspicious \
@@ -106,8 +105,7 @@ jobs:
106105
-D clippy::dbg_macro \
107106
-D clippy::todo \
108107
-D clippy::unimplemented \
109-
-D warnings \
110-
-A clippy::precedence
108+
-D warnings
111109
112110
113111
unit-test:

.github/workflows/release-version.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ jobs:
133133
-D clippy::dbg_macro \
134134
-D clippy::todo \
135135
-D clippy::unimplemented \
136-
-D warnings \
137-
-A clippy::precedence
136+
-D warnings
138137
139138
rustfmt:
140139
runs-on: ubuntu-latest

check.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,6 @@ 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-
155149
run cargo clippy --all-targets "${extraCargoArgs[@]}" -- \
156150
-D clippy::suspicious \
157151
-D clippy::style \
@@ -160,13 +154,10 @@ function cmd_clippy() {
160154
-D clippy::dbg_macro \
161155
-D clippy::todo \
162156
-D clippy::unimplemented \
163-
-D warnings \
164-
-A clippy::precedence
157+
-D warnings
165158
}
166159

167160
function cmd_klippy() {
168-
# TODO(Rust 1.86): remove `-A clippy::precedence`.
169-
170161
run cargo clippy --fix --all-targets "${extraCargoArgs[@]}" -- \
171162
-D clippy::suspicious \
172163
-D clippy::style \
@@ -175,8 +166,7 @@ function cmd_klippy() {
175166
-D clippy::dbg_macro \
176167
-D clippy::todo \
177168
-D clippy::unimplemented \
178-
-D warnings \
179-
-A clippy::precedence
169+
-D warnings
180170
}
181171

182172
function cmd_test() {

godot-bindings/src/import.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ pub use gdextension_api::version_4_4 as prebuilt;
8383
feature = "api-custom",
8484
)))]
8585
// ]]
86-
8786
// [version-sync] [[
8887
// [include] current.minor
8988
// [line] pub use gdextension_api::version_$snakeVersion as prebuilt;

godot-core/src/obj/on_ready.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl<T> OnReady<T> {
208208
/// - If this object was already provided with a closure during construction, in [`Self::new()`] or any other automatic constructor.
209209
pub fn init(&mut self, value: T) {
210210
match &self.state {
211-
InitState::ManualUninitialized { .. } => {
211+
InitState::ManualUninitialized => {
212212
self.state = InitState::Initialized { value };
213213
}
214214
InitState::AutoPrepared { .. } => {
@@ -285,7 +285,7 @@ impl<T> std::ops::DerefMut for OnReady<T> {
285285
fn deref_mut(&mut self) -> &mut Self::Target {
286286
match &mut self.state {
287287
InitState::Initialized { value } => value,
288-
InitState::ManualUninitialized { .. } | InitState::AutoPrepared { .. } => {
288+
InitState::ManualUninitialized | InitState::AutoPrepared { .. } => {
289289
panic!("value not yet initialized")
290290
}
291291
InitState::AutoInitializing => unreachable!(),

itest/repo-tweak/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn sync_versions_recursive(parent_dir: &Path, top_level: bool) {
7676

7777
let mut file = File::create(path).expect("create file");
7878
for m in ranges {
79-
file.write_all(content[last_pos..m.start].as_bytes())
79+
file.write_all(&content.as_bytes()[last_pos..m.start])
8080
.expect("write file (before start)");
8181

8282
// Note: m.start..m.end is discarded and replaced with newly generated lines.
@@ -98,13 +98,13 @@ fn sync_versions_recursive(parent_dir: &Path, top_level: bool) {
9898
file.write_all(post.as_bytes()).expect("write file (post)");
9999
}
100100

101-
file.write_all(content[m.end..m.after_end].as_bytes())
101+
file.write_all(&content.as_bytes()[m.end..m.after_end])
102102
.expect("write file (after end)");
103103

104104
last_pos = m.after_end;
105105
}
106106

107-
file.write_all(content[last_pos..].as_bytes())
107+
file.write_all(&content.as_bytes()[last_pos..])
108108
.expect("write to file (end)");
109109
}
110110
}

itest/rust/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ fn write_gdscript_code(
572572

573573
let ranges = repo_tweak::find_repeated_ranges(&template, "#(", "#)", &[], false);
574574
for m in ranges {
575-
file.write_all(template[last..m.before_start].as_bytes())?;
575+
file.write_all(&template.as_bytes()[last..m.before_start])?;
576576

577577
replace_parts(&template[m.start..m.end], inputs, |replacement| {
578578
file.write_all(replacement.as_bytes())?;
@@ -581,7 +581,7 @@ fn write_gdscript_code(
581581

582582
last = m.after_end;
583583
}
584-
file.write_all(template[last..].as_bytes())?;
584+
file.write_all(&template.as_bytes()[last..])?;
585585

586586
Ok(())
587587
}

0 commit comments

Comments
 (0)