Skip to content

Lint against [T].iter().last() and suggest [T].last() #15487

@estebank

Description

@estebank

Converting a slice into an iterator purely to get the last element of it is unnecessary, but if someone is not aware of [T]::last (like I was) would cargo cult the "turn into iterator and get the first/last element" pattern.

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions