about summary refs log tree commit diff
path: root/src/rustllvm/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2020-04-08 15:50:17 +0200
committerGitHub <noreply@github.com>2020-04-08 15:50:17 +0200
commit1e1bd519a176f5e518c51814958dc64e8e7c1758 (patch)
tree1612307bb9ebc31d57d900367d804decb4b456dc /src/rustllvm/CoverageMappingWrapper.cpp
parent935b45db61e9906c8371718af3fca101dc3ce376 (diff)
parent94154cad20d4687461fcbb4901a1252576329d13 (diff)
downloadrust-1e1bd519a176f5e518c51814958dc64e8e7c1758.tar.gz
rust-1e1bd519a176f5e518c51814958dc64e8e7c1758.zip
Rollup merge of #5410 - dtolnay:trivially, r=flip1995
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
Diffstat (limited to 'src/rustllvm/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions