Open
Description
What it does
Well, exactly as the title described, and could apply to while
s as well.
The idea is kinda like a combination of [unnecessary_unwrap
] and [get_first
].
Such lint might already exist, idk.
Advantage
Readability?
Drawbacks
maybe? maybe not?
Example
if !seq.is_empty() {
let x = seq[0];
// ...
}
Could be written as:
if let Some(x) = seq.first() {
// ...
}