From d08e41417971f1d05b9daa75f794536a1dd4bedf Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 15 Dec 2025 14:29:11 +0100 Subject: [PATCH] Update MSRV to 1.90 (#21987) --- Cargo.toml | 2 +- crates/ruff/src/args.rs | 2 +- crates/ruff/src/lib.rs | 2 +- crates/ruff_formatter/src/macros.rs | 4 ++-- crates/ruff_linter/src/fix/edits.rs | 7 +------ .../src/rules/flake8_simplify/rules/yoda_conditions.rs | 2 +- crates/ruff_python_codegen/src/generator.rs | 1 + crates/ruff_python_formatter/src/cli.rs | 2 +- crates/ty_ide/src/completion.rs | 3 +-- crates/ty_project/src/lib.rs | 1 - crates/ty_python_semantic/src/types.rs | 1 - rust-toolchain.toml | 2 +- 12 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dbd9808fdd..bd06571cd3 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.89" +rust-version = "1.90" homepage = "https://docs.astral.sh/ruff" documentation = "https://docs.astral.sh/ruff" repository = "https://github.com/astral-sh/ruff" diff --git a/crates/ruff/src/args.rs b/crates/ruff/src/args.rs index 370186a0b4..da6d3833b7 100644 --- a/crates/ruff/src/args.rs +++ b/crates/ruff/src/args.rs @@ -10,7 +10,7 @@ use anyhow::bail; use clap::builder::Styles; use clap::builder::styling::{AnsiColor, Effects}; use clap::builder::{TypedValueParser, ValueParserFactory}; -use clap::{Parser, Subcommand, command}; +use clap::{Parser, Subcommand}; use colored::Colorize; use itertools::Itertools; use path_absolutize::path_dedot; diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index 3ea0d94fad..3ecefd6dde 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -9,7 +9,7 @@ use std::sync::mpsc::channel; use anyhow::Result; use clap::CommandFactory; use colored::Colorize; -use log::{error, warn}; +use log::error; use notify::{RecursiveMode, Watcher, recommended_watcher}; use args::{GlobalConfigArgs, ServerCommand}; diff --git a/crates/ruff_formatter/src/macros.rs b/crates/ruff_formatter/src/macros.rs index 4d0d3ef234..8090d41397 100644 --- a/crates/ruff_formatter/src/macros.rs +++ b/crates/ruff_formatter/src/macros.rs @@ -337,7 +337,7 @@ macro_rules! best_fitting { #[cfg(test)] mod tests { use crate::prelude::*; - use crate::{FormatState, SimpleFormatOptions, VecBuffer, write}; + use crate::{FormatState, SimpleFormatOptions, VecBuffer}; struct TestFormat; @@ -385,8 +385,8 @@ mod tests { #[test] fn best_fitting_variants_print_as_lists() { + use crate::Formatted; use crate::prelude::*; - use crate::{Formatted, format, format_args}; // The second variant below should be selected when printing at a width of 30 let formatted_best_fitting = format!( diff --git a/crates/ruff_linter/src/fix/edits.rs b/crates/ruff_linter/src/fix/edits.rs index 20f50d6e10..b5420e4ee1 100644 --- a/crates/ruff_linter/src/fix/edits.rs +++ b/crates/ruff_linter/src/fix/edits.rs @@ -286,12 +286,7 @@ pub(crate) fn add_argument(argument: &str, arguments: &Arguments, tokens: &Token /// Generic function to add a (regular) parameter to a function definition. pub(crate) fn add_parameter(parameter: &str, parameters: &Parameters, source: &str) -> Edit { - if let Some(last) = parameters - .args - .iter() - .filter(|arg| arg.default.is_none()) - .next_back() - { + if let Some(last) = parameters.args.iter().rfind(|arg| arg.default.is_none()) { // Case 1: at least one regular parameter, so append after the last one. Edit::insertion(format!(", {parameter}"), last.end()) } else if !parameters.args.is_empty() { diff --git a/crates/ruff_linter/src/rules/flake8_simplify/rules/yoda_conditions.rs b/crates/ruff_linter/src/rules/flake8_simplify/rules/yoda_conditions.rs index 687729c20c..84aff5ce5e 100644 --- a/crates/ruff_linter/src/rules/flake8_simplify/rules/yoda_conditions.rs +++ b/crates/ruff_linter/src/rules/flake8_simplify/rules/yoda_conditions.rs @@ -146,7 +146,7 @@ fn reverse_comparison(expr: &Expr, locator: &Locator, stylist: &Stylist) -> Resu let left = (*comparison.left).clone(); // Copy the right side to the left side. - comparison.left = Box::new(comparison.comparisons[0].comparator.clone()); + *comparison.left = comparison.comparisons[0].comparator.clone(); // Copy the left side to the right side. comparison.comparisons[0].comparator = left; diff --git a/crates/ruff_python_codegen/src/generator.rs b/crates/ruff_python_codegen/src/generator.rs index 710e295f62..362d00d235 100644 --- a/crates/ruff_python_codegen/src/generator.rs +++ b/crates/ruff_python_codegen/src/generator.rs @@ -1247,6 +1247,7 @@ impl<'a> Generator<'a> { self.p_bytes_repr(&bytes_literal.value, bytes_literal.flags); } } + #[expect(clippy::eq_op)] Expr::NumberLiteral(ast::ExprNumberLiteral { value, .. }) => { static INF_STR: &str = "1e309"; assert_eq!(f64::MAX_10_EXP, 308); diff --git a/crates/ruff_python_formatter/src/cli.rs b/crates/ruff_python_formatter/src/cli.rs index 96da64e86e..df289f08d8 100644 --- a/crates/ruff_python_formatter/src/cli.rs +++ b/crates/ruff_python_formatter/src/cli.rs @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; -use clap::{Parser, ValueEnum, command}; +use clap::{Parser, ValueEnum}; use ruff_formatter::SourceCode; use ruff_python_ast::{PySourceType, PythonVersion}; diff --git a/crates/ty_ide/src/completion.rs b/crates/ty_ide/src/completion.rs index ca2305df0c..4e5051ddcc 100644 --- a/crates/ty_ide/src/completion.rs +++ b/crates/ty_ide/src/completion.rs @@ -4711,8 +4711,7 @@ from os. let last_nonunderscore = test .completions() .iter() - .filter(|c| !c.name.starts_with('_')) - .next_back() + .rfind(|c| !c.name.starts_with('_')) .unwrap(); assert_eq!(&last_nonunderscore.name, "type_check_only"); diff --git a/crates/ty_project/src/lib.rs b/crates/ty_project/src/lib.rs index fe034b0a07..2bcb287b40 100644 --- a/crates/ty_project/src/lib.rs +++ b/crates/ty_project/src/lib.rs @@ -27,7 +27,6 @@ use std::iter::FusedIterator; use std::panic::{AssertUnwindSafe, UnwindSafe}; use std::sync::Arc; use thiserror::Error; -use tracing::error; use ty_python_semantic::add_inferred_python_version_hint_to_diagnostic; use ty_python_semantic::lint::RuleSelection; use ty_python_semantic::types::check_types; diff --git a/crates/ty_python_semantic/src/types.rs b/crates/ty_python_semantic/src/types.rs index 726decfc07..b318638742 100644 --- a/crates/ty_python_semantic/src/types.rs +++ b/crates/ty_python_semantic/src/types.rs @@ -10691,7 +10691,6 @@ pub struct UnionTypeInstance<'db> { /// ``. For `Union[int, str]`, this field is `None`, as we infer /// the elements as type expressions. Use `value_expression_types` to get the /// corresponding value expression types. - #[expect(clippy::ref_option)] #[returns(ref)] _value_expr_types: Option]>>, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1a35d66439..50b3f5d474 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.91" +channel = "1.92"