Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Jul 6, 2023
1 parent be8e7b6 commit 139e6c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/ruff/src/checkers/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
)));
}

Expand Down

0 comments on commit 139e6c1

Please sign in to comment.