1e1bd519a1
Downgrade trivially_copy_pass_by_ref to pedantic The rationale for this lint is documented as: > In many calling conventions instances of structs will be passed through registers if they fit into two or less general purpose registers. I think the purported performance benefits of clippy's recommendation are overstated. This isn't worth asking people to sprinkle code with more `*``*``&``*``&` to chase the alleged performance. This should be a pedantic lint that is disabled by default and opted in if some specific performance sensitive codebase determines that it is worthwhile. As a reminder, a typical place that a reference to a primitive would come up is if the function is used as a filter. Triggering a performance-oriented lint on this type of code is the definition of pedantic. ```rust fn filter(_n: &i32) -> bool { true } fn main() { let v = vec![1, 2, 3]; v.iter().copied().filter(filter).for_each(drop); } ``` ```console warning: this argument (4 byte) is passed by reference, but would be more efficient if passed by value (limit: 8 byte) --> src/main.rs:1:15 | 1 | fn filter(_n: &i32) -> bool { | ^^^^ help: consider passing by value instead: `i32` ``` changelog: Remove trivially_copy_pass_by_ref from default set of enabled lints |
||
---|---|---|
.. | ||
auxiliary | ||
cargo | ||
ui | ||
ui-toml | ||
compile-test.rs | ||
dogfood.rs | ||
fmt.rs | ||
integration.rs | ||
missing-test-files.rs | ||
versioncheck.rs |