From 7caedf3037e290974b99b760da4724bfe942ed60 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 19:51:53 +0000 Subject: [PATCH 1/3] Bump Rust 1.97.1 -> 1.98.1 in rust-toolchain.toml No other genuine version pin exists in this repo: every "Install Rust toolchain" CI step reads rust-toolchain.toml (`rustup show`), the MSRV job derives its version from Cargo.toml's workspace.package.rust-version at runtime, and the Dockerfile installs from the copied rust-toolchain.toml. Only a prose comment in ruff_r2il/Cargo.toml duplicated the old toolchain number; reworded it to point at rust-toolchain.toml instead of restating the version. Also drops `from_iter_instead_of_collect = "warn"` from ruff_annotate_snippets's [lints.clippy] table: the lint was removed in 1.98 and the stale entry now fires `renamed_and_removed_lints` (a warning that explicitly ignores -D warnings, so it wasn't failing CI, just stale). The only other 1.98 clippy delta, `chunks_exact_to_as_chunks`, cannot fire anywhere in this repo: no source file calls `.chunks_exact(`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V --- crates/ruff_annotate_snippets/Cargo.toml | 1 - crates/ruff_r2il/Cargo.toml | 4 ++-- rust-toolchain.toml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/ruff_annotate_snippets/Cargo.toml b/crates/ruff_annotate_snippets/Cargo.toml index 99bad240ae4e9..0407984d3f59f 100644 --- a/crates/ruff_annotate_snippets/Cargo.toml +++ b/crates/ruff_annotate_snippets/Cargo.toml @@ -56,7 +56,6 @@ filter_map_next = "warn" flat_map_option = "warn" float_cmp_const = "warn" fn_params_excessive_bools = "warn" -from_iter_instead_of_collect = "warn" if_same_then_else = "allow" implicit_clone = "warn" imprecise_flops = "warn" diff --git a/crates/ruff_r2il/Cargo.toml b/crates/ruff_r2il/Cargo.toml index d89bc48313448..c7ff5b088292f 100644 --- a/crates/ruff_r2il/Cargo.toml +++ b/crates/ruff_r2il/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" publish = false # Excluded from the ruff workspace (root `exclude`), so nothing here can inherit from # [workspace.package] / [workspace.dependencies] / [workspace.lints]. edition/rust-version are -# pinned by hand to satisfy BOTH sides: ruff (edition 2024, rust-version 1.93, toolchain 1.97.1) -# and r2sleigh (edition 2024). +# pinned by hand to satisfy BOTH sides: ruff (edition 2024, rust-version per the workspace +# Cargo.toml, toolchain per rust-toolchain.toml) and r2sleigh (edition 2024). edition = "2024" rust-version = "1.93" description = "R2IL intake arm: a lossless ore carrier over r2sleigh's r2il/r2ssa object graph, a furnace that melts it into flat facet-addressed concern rows, and an addressed residual (slag) ledger. Ore in, named slag out — no catch-all, nothing dropped." diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 72436043232ca..642220914d8a7 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.97.1" +channel = "1.98.1" From 606d4102fa8dec5dc752b393d8d2ab0748ae3ea5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 20:02:59 +0000 Subject: [PATCH 2/3] Fix four clippy findings that 1.98 gates as errors The toolchain bump turns `-D warnings` red on four pre-existing sites. None of the four lints is new in 1.98; they were simply never enforced against this code before the pin moved. `format_push_string` (ty_python_semantic tests, two sites): the `push_str(&format!(..))` pairs allocate an intermediate `String` per loop iteration. Rewritten as `let _ = write!(..)`, the idiom this repo already uses at 105 call sites, with `use std::fmt::Write as _` at the top of the file per the imports-at-the-top rule. The anonymous import form avoids colliding with the file's `use super::*`. `useless_format` (ruff_linter, two sites): `format!("{x}")` on a value that already renders to the same string, replaced with `to_string()`. Output is unchanged in all four cases. The `write!` rewrite was checked against a standalone reproduction of the loop rather than a full workspace build, which will not fit in the available disk here; CI runs the real gate. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V --- crates/ruff_linter/src/linter.rs | 2 +- crates/ruff_linter/src/noqa.rs | 2 +- crates/ty_python_semantic/src/types/infer/tests.rs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/ruff_linter/src/linter.rs b/crates/ruff_linter/src/linter.rs index fc07c4e93c66f..b7454e0a5ea7a 100644 --- a/crates/ruff_linter/src/linter.rs +++ b/crates/ruff_linter/src/linter.rs @@ -1059,7 +1059,7 @@ mod tests { }, ); insta::with_settings!({filters => vec![(r"\\", "/")]}, { - assert_diagnostics!(format!("{snapshot}"), diagnostics); + assert_diagnostics!(snapshot.to_string(), diagnostics); }); Ok(()) diff --git a/crates/ruff_linter/src/noqa.rs b/crates/ruff_linter/src/noqa.rs index 9c8b973e4c668..3388be09799f5 100644 --- a/crates/ruff_linter/src/noqa.rs +++ b/crates/ruff_linter/src/noqa.rs @@ -3350,7 +3350,7 @@ mod tests { PreviewMode::Disabled, ); assert_eq!(count, 0); - assert_eq!(output, format!("{contents}")); + assert_eq!(output, contents.to_string()); let source_file = SourceFileBuilder::new(path.to_string_lossy(), contents).finish(); let messages = [UnusedVariable { diff --git a/crates/ty_python_semantic/src/types/infer/tests.rs b/crates/ty_python_semantic/src/types/infer/tests.rs index 223deb1cb4277..04fe3034a8ea2 100644 --- a/crates/ty_python_semantic/src/types/infer/tests.rs +++ b/crates/ty_python_semantic/src/types/infer/tests.rs @@ -1,3 +1,5 @@ +use std::fmt::Write as _; + use super::builder::TypeInferenceBuilder; use crate::db::tests::{TestDb, TestDbBuilder, setup_db}; use crate::place::symbol; @@ -582,7 +584,8 @@ class Ui: ); for index in 0..MANY_WIDGETS { - ui.push_str(&format!( + let _ = write!( + ui, concat!( " self.widget_{index} = Widget()\n", " self.widget_{index}.configure()\n", @@ -590,7 +593,7 @@ class Ui: " self.widget_{index}.configure()\n", ), index = index, - )); + ); } ui.push_str(" self.target = Widget()\n"); @@ -639,7 +642,8 @@ class Inner: "#, ); for index in 0..MANY_WIDGETS { - inner.push_str(&format!( + let _ = write!( + inner, concat!( " self.widget_{index} = Widget()\n", " self.widget_{index}.configure()\n", @@ -647,7 +651,7 @@ class Inner: " self.widget_{index}.configure()\n", ), index = index, - )); + ); } inner.push_str(" self.target = Widget()\n"); From 2a314fb778896e2114a443fc8c2385f56715b514 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 5 Sep 2026 20:25:29 +0000 Subject: [PATCH 3/3] Move the snapshot name instead of re-owning it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit replaced `format!("{snapshot}")` with `snapshot.to_string()`, which silenced `useless_format` and immediately tripped `implicitly_cloning_a_string`: `snapshot` is already a `String`, so `to_string` goes through `Deref` and allocates a second copy of the same bytes. It is the last use of the binding in that function and the macro takes it by value, so passing it directly is both what the code means and what the lints want. The argument's type is unchanged — `format!` also produced a `String`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01AGVLyRZNEKKBSfBDJfbY3V --- crates/ruff_linter/src/linter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/linter.rs b/crates/ruff_linter/src/linter.rs index b7454e0a5ea7a..c04e3001af6b1 100644 --- a/crates/ruff_linter/src/linter.rs +++ b/crates/ruff_linter/src/linter.rs @@ -1059,7 +1059,7 @@ mod tests { }, ); insta::with_settings!({filters => vec![(r"\\", "/")]}, { - assert_diagnostics!(snapshot.to_string(), diagnostics); + assert_diagnostics!(snapshot, diagnostics); }); Ok(())