mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
d6991abc5a
`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` |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |