From 139e6c1b020ffa65912680513aa4bb40a83f45d5 Mon Sep 17 00:00:00 2001 From: Evan Rittenhouse Date: Wed, 5 Jul 2023 20:05:53 -0500 Subject: [PATCH] Clippy --- crates/ruff/src/checkers/ast/mod.rs | 2 +- .../unnecessary_list_allocation_for_first_element.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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, ))); }