rust-lang/rust-clippy

`or_fun_call` isn't always a performance lint

Open

#8574 aperta il 22 mar 2022

Vedi su GitHub
 (11 commenti) (0 reazioni) (0 assegnatari)Rust (1391 fork)batch import
A-categoryL-nurserygood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

Replacing .unwrap_or(Vec::new()) with .unwrap_or_default() doesn't do anything for performance, they produce identical machine code with optimizations: https://rust.godbolt.org/z/hzTdazGqW.

Perhaps the lint category could be changed or it could be changed to not detect cases where it's not actually a performance warning?

Guida contributor