From 41d30df6fdbe215390b3acb46e8cd4017f65580d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 1 Oct 2026 12:20:10 -0400 Subject: [PATCH] Update Rust toolchain to 1.99 and MSRV to 1.97 (#29047) ## Summary - Update the Rust toolchain to 1.99.0 and the MSRV to 1.97, following our N-2 support policy. - Address the new Clippy warnings and preserve our existing assertion and formatting macro conventions. - Update Hawk to 0.1.15 and run it with Rust 1.99.0. --- .github/workflows/ci.yaml | 6 +- Cargo.toml | 5 +- crates/ruff/src/lib.rs | 151 +++++++++--------- crates/ty_module_resolver/src/module_name.rs | 1 - crates/ty_python_semantic/src/place.rs | 2 +- .../ty_python_semantic/src/types/display.rs | 2 +- .../src/types/infer/builder/enum_call.rs | 2 +- rust-toolchain.toml | 2 +- 8 files changed, 86 insertions(+), 85 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd93b7f294..e1126b7fb3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ env: CARGO_PROFILE_DEV_OPT_LEVEL: 0 CARGO_TERM_COLOR: always # renovate: datasource=github-releases depName=astral-sh/hawk - HAWK_VERSION: 0.1.13 + HAWK_VERSION: 0.1.15 RUSTUP_MAX_RETRIES: 10 PACKAGE_NAME: ruff PYTHON_VERSION: "3.14" @@ -355,13 +355,13 @@ jobs: cache-workspace-crates: "false" save-if: ${{ github.ref == 'refs/heads/main' }} - name: "Install Rust toolchain" - run: rustup toolchain install 1.98.0 + run: rustup toolchain install 1.99.0 - name: "Install Hawk" run: | curl --proto '=https' --tlsv1.2 -LsSf \ "https://github.com/astral-sh/hawk/releases/download/${HAWK_VERSION}/cargo-hawk-installer.sh" | sh - name: "Hawk" - run: cargo +1.98.0 hawk check --target-dir target/hawk -D warnings + run: cargo +1.99.0 hawk check --target-dir target/hawk -D warnings cargo-publish-dry-run: name: "cargo publish dry-run" diff --git a/Cargo.toml b/Cargo.toml index 8d89233e41..907073cd6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" [workspace.package] # Please update rustfmt.toml when bumping the Rust edition edition = "2024" -rust-version = "1.96" +rust-version = "1.97" homepage = "https://docs.astral.sh/ruff" documentation = "https://docs.astral.sh/ruff" repository = "https://github.com/astral-sh/ruff" @@ -272,6 +272,7 @@ pedantic = { level = "warn", priority = -2 } # Enabled at the crate level disallowed_methods = "allow" # Allowed pedantic lints +assert_is_empty = "allow" char_lit_as_u8 = "allow" collapsible_else_if = "allow" collapsible_if = "allow" @@ -282,6 +283,8 @@ missing_errors_doc = "allow" missing_panics_doc = "allow" module_name_repetitions = "allow" must_use_candidate = "allow" +# Our formatting macros share names with std macros but use square brackets. +nonstandard_macro_braces = "allow" similar_names = "allow" single_match_else = "allow" too_many_lines = "allow" diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index b0cbd385b2..cb628666f4 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -430,96 +430,95 @@ pub fn check(args: CheckCommand, global_options: GlobalConfigArgs) -> Result>(), vec!["foo", "bar", "baz"]); /// ``` - #[must_use] pub fn components(&self) -> impl DoubleEndedIterator { self.0.split('.') } diff --git a/crates/ty_python_semantic/src/place.rs b/crates/ty_python_semantic/src/place.rs index f0b8e863ea..41b7fd44c1 100644 --- a/crates/ty_python_semantic/src/place.rs +++ b/crates/ty_python_semantic/src/place.rs @@ -708,7 +708,7 @@ fn builtins_symbol_impl<'db>( resolver_environment, &ModuleName::new_static("__builtins__").unwrap(), ) - .and_then(&resolver) + .and_then(resolver) .or_else(|| { resolve_module_confident(db, resolver_environment, &KnownModule::Builtins.name()) .and_then(resolver) diff --git a/crates/ty_python_semantic/src/types/display.rs b/crates/ty_python_semantic/src/types/display.rs index 9f5ea0d653..8ad5f8305b 100644 --- a/crates/ty_python_semantic/src/types/display.rs +++ b/crates/ty_python_semantic/src/types/display.rs @@ -538,7 +538,7 @@ impl Drop for TypeDetailGuard<'_, '_, '_, '_> { fn drop(&mut self) { // The fallibility here is primarily retrieving `TypeWriter::Details` // everything else is ideally-never-fails pedantry (yay for pedantry!) - if let TypeWriter::Details(details) = &mut self.inner + if let TypeWriter::Details(details) = &mut *self.inner && let Some(start) = self.start && let Some(payload) = self.payload.take() { diff --git a/crates/ty_python_semantic/src/types/infer/builder/enum_call.rs b/crates/ty_python_semantic/src/types/infer/builder/enum_call.rs index 8f28fb6b4b..6e016404bd 100644 --- a/crates/ty_python_semantic/src/types/infer/builder/enum_call.rs +++ b/crates/ty_python_semantic/src/types/infer/builder/enum_call.rs @@ -209,7 +209,7 @@ fn next_auto_value<'db>( if last <= 0 { Type::int_literal(1) } else { - let shift = i64::BITS - last.leading_zeros(); + let shift = last.cast_unsigned().bit_width(); 1_u64 .checked_shl(shift) .and_then(|value| i64::try_from(value).ok()) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b73c15e3c4..b6cff89e61 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.98.0" +channel = "1.99.0"