diff options
| author | bors <bors@rust-lang.org> | 2022-05-07 12:31:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-07 12:31:47 +0000 |
| commit | 9c78883fdf5ccdeef833bc99095a18dcf6312d0b (patch) | |
| tree | 5190db86453f593b5b4ae6d7ffc4df4dd5e9138d /compiler/rustc_codegen_llvm/src | |
| parent | 43756b6e4dda9c46265aa79c98163ff7ef915274 (diff) | |
| parent | 91a822c16228c57bf57961271ecb2d0d28112fa4 (diff) | |
| download | rust-9c78883fdf5ccdeef833bc99095a18dcf6312d0b.tar.gz rust-9c78883fdf5ccdeef833bc99095a18dcf6312d0b.zip | |
Auto merge of #8794 - smoelius:fix-8759, r=llogiq
Address `unnecessary_to_owned` false positive
My proposed fix for #8759 is to revise the conditions that delineate `redundant_clone` and `unnecessary_to_owned`:
```rust
// Only flag cases satisfying at least one of the following three conditions:
// * the referent and receiver types are distinct
// * the referent/receiver type is a copyable array
// * the method is `Cow::into_owned`
// This restriction is to ensure there is no overlap between `redundant_clone` and this
// lint. It also avoids the following false positive:
// https://github.com/rust-lang/rust-clippy/issues/8759
// Arrays are a bit of a corner case. Non-copyable arrays are handled by
// `redundant_clone`, but copyable arrays are not.
```
This change causes a few cases that were previously flagged by `unnecessary_to_owned` to no longer be flagged. But one could argue those cases would be better handled by `redundant_clone`.
Closes #8759
changelog: none
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
