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..0b69cefc38 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; @@ -386,7 +386,7 @@ mod tests { #[test] fn best_fitting_variants_print_as_lists() { use crate::prelude::*; - use crate::{Formatted, format, format_args}; + use crate::Formatted; // 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..77e9ca0c67 100644 --- a/crates/ruff_linter/src/fix/edits.rs +++ b/crates/ruff_linter/src/fix/edits.rs @@ -288,9 +288,7 @@ pub(crate) fn add_argument(argument: &str, arguments: &Arguments, tokens: &Token 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() + .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()) 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..4af8196303 100644 --- a/crates/ty_ide/src/completion.rs +++ b/crates/ty_ide/src/completion.rs @@ -4710,9 +4710,7 @@ from os. let test = builder.build(); let last_nonunderscore = test .completions() - .iter() - .filter(|c| !c.name.starts_with('_')) - .next_back() + .iter().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"