rust-lang/rust-clippy

`or_fun_call` isn't always a performance lint

Open

#8,574 opened on Mar 22, 2022

View on GitHub
 (11 comments) (0 reactions) (0 assignees)Rust (1,391 forks)batch import
A-categoryL-nurserygood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (Avg merge 19d 22h) (113 merged PRs in 30d)

Description

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?

Contributor guide