diff --git a/crates/ruff/src/checkers/ast/mod.rs b/crates/ruff/src/checkers/ast/mod.rs index b325af8abfa6a8..ef73164dfad08e 100644 --- a/crates/ruff/src/checkers/ast/mod.rs +++ b/crates/ruff/src/checkers/ast/mod.rs @@ -2207,7 +2207,7 @@ where } if self.enabled(Rule::UnnecessaryListAllocationForFirstElement) { ruff::rules::unnecessary_list_allocation_for_first_element( - self, value, slice, range, + self, value, slice, *range, ); } diff --git a/crates/ruff/src/rules/ruff/rules/unnecessary_list_allocation_for_first_element.rs b/crates/ruff/src/rules/ruff/rules/unnecessary_list_allocation_for_first_element.rs index d4d0c913eb7f4f..5cc5796d18985b 100644 --- a/crates/ruff/src/rules/ruff/rules/unnecessary_list_allocation_for_first_element.rs +++ b/crates/ruff/src/rules/ruff/rules/unnecessary_list_allocation_for_first_element.rs @@ -65,7 +65,7 @@ pub(crate) fn unnecessary_list_allocation_for_first_element( checker: &mut Checker, call: &Expr, slice: &Expr, - subscript_range: &TextRange, + subscript_range: TextRange, ) { if !indexes_first_element(slice) { return; @@ -76,14 +76,14 @@ pub(crate) fn unnecessary_list_allocation_for_first_element( let mut diagnostic = Diagnostic::new( UnnecessaryListAllocationForFirstElement::new(iter_name.to_string()), - *subscript_range, + subscript_range, ); if checker.patch(diagnostic.kind.rule()) { - let replacement = format!("next(iter({}))", iter_name); + let replacement = format!("next(iter({iter_name}))"); diagnostic.set_fix(Fix::suggested(Edit::range_replacement( replacement, - *subscript_range, + subscript_range, ))); }