about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-13 13:19:48 +0000
committerbors <bors@rust-lang.org>2024-05-13 13:19:48 +0000
commitd6991abc5ac9451ad1c91d68aeb28b816f326265 (patch)
tree25e62e9fb07791cd877dd41160de92a35c59adf3 /compiler/rustc_codegen_llvm/src
parenta4a1a7365d60280b83d83374fda97742fb959239 (diff)
parent509ca90bf1201c00ba2a519dc590c83dc73bdb3b (diff)
downloadrust-d6991abc5ac9451ad1c91d68aeb28b816f326265.tar.gz
rust-d6991abc5ac9451ad1c91d68aeb28b816f326265.zip
Auto merge of #12764 - lrh2000:ignore-place, r=blyxyas
`significant_drop_in_scrutinee`: Fix false positives due to false drops of place expressions

Place expressions do not really create temporaries, so they will not create significant drops. For example, the following code snippet is quite good (#8963):
```rust
fn main() {
    let x = std::sync::Mutex::new(vec![1, 2, 3]);
    let x_guard = x.lock().unwrap();
    match x_guard[0] {
        1 => println!("1!"),
        x => println!("{x}"),
    }
    drop(x_guard); // Some "usage"
}
```

Also, the previous logic thinks that references like `&MutexGuard<_>`/`Ref<'_, MutexGuard<'_, _>>` have significant drops, which is simply not true, so it is fixed together in this PR.

Fixes https://github.com/rust-lang/rust-clippy/issues/8963
Fixes https://github.com/rust-lang/rust-clippy/issues/9072

changelog: [`significant_drop_in_scrutinee`]: Fix false positives due to false drops of place expressions.

r? `@blyxyas`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions