mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Simplify iteration idioms (#13834)
Remove unnecessary uses of `.as_ref()`, `.iter()`, `&**` and similar, mostly in situations when iterating over variables. Many of these changes are only possible following #13826, when we bumped our MSRV to 1.80: several useful implementations on `&Box<[T]>` were only stabilised in Rust 1.80. Some of these changes we could have done earlier, however.
This commit is contained in:
parent
7fd8e30eed
commit
72adb09bf3
36 changed files with 72 additions and 73 deletions
|
@ -795,7 +795,7 @@ impl<'a> SemanticModel<'a> {
|
|||
let resolved: QualifiedName = qualified_name
|
||||
.segments()
|
||||
.iter()
|
||||
.chain(tail.iter())
|
||||
.chain(tail)
|
||||
.copied()
|
||||
.collect();
|
||||
Some(resolved)
|
||||
|
@ -809,7 +809,7 @@ impl<'a> SemanticModel<'a> {
|
|||
.segments()
|
||||
.iter()
|
||||
.take(1)
|
||||
.chain(tail.iter())
|
||||
.chain(tail)
|
||||
.copied()
|
||||
.collect(),
|
||||
)
|
||||
|
@ -832,7 +832,7 @@ impl<'a> SemanticModel<'a> {
|
|||
qualified_name
|
||||
.segments()
|
||||
.iter()
|
||||
.chain(tail.iter())
|
||||
.chain(tail)
|
||||
.copied()
|
||||
.collect()
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue