about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMichael Baikov <manpacket@gmail.com>2024-04-23 09:32:35 -0400
committerMichael Baikov <manpacket@gmail.com>2024-05-05 12:08:38 -0400
commit79a14dea86fe8e8f5588fb2a32f5b73f065529a3 (patch)
tree614d0f855e46169b9533f692a9c25022d65345f5 /compiler/rustc_codegen_llvm/src
parent28002514d539352f362d79c814dac5352c7ac9bb (diff)
downloadrust-79a14dea86fe8e8f5588fb2a32f5b73f065529a3.tar.gz
rust-79a14dea86fe8e8f5588fb2a32f5b73f065529a3.zip
less aggressive needless_borrows_for_generic_args
Current implementation looks for significant drops, that can change the
behavior, but that's not enough - value might not have a Drop itself but
one of its children might have it.

A good example is passing a reference to `PathBuf` to `std::fs::File::open`.
There's no benefits to pass `PathBuf` by value, but since clippy can't
see `Drop` on `Vec` several layers down it complains forcing pass by
value and making it impossible to use the same name later.

New implementation only looks at copy values or values created inplace
so existing variable will never be moved but things that take a string
reference created and value is created inplace `&"".to_owned()` will
make it to suggest to use `"".to_owned()` still.

Fixes https://github.com/rust-lang/rust-clippy/issues/12454
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions