There was an error while loading. Please reload this page.
if let Some(x) = arr.first()
if !arr.is_empty() then arr[0]
Well, exactly as the title described, and could apply to whiles as well.
while
The idea is kinda like a combination of [unnecessary_unwrap] and [get_first].
unnecessary_unwrap
get_first
Such lint might already exist, idk.
Readability?
maybe? maybe not?
if !seq.is_empty() { let x = seq[0]; // ... }
Could be written as:
if let Some(x) = seq.first() { // ... }