significant_drop_in_scrutinee
fires when matching on async function result
#13927
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
When calling an async function that returns a
MutexGuard
the lint fires.Lint Name
significant_drop_in_scrutinee
Reproducer
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=9193048ab64be887f2aa4cb7af02e490
I saw this happen:
I expected to see this happen:
No lint emitted, we're destructuring a value with the
MutexGuard
itself and assigning it.At first I thought this was a problem with the code that has only that, i.e. matching on some
fn foo(mutex: &Mutex<T>) -> Option<MutexGuard<'_, T>>
, but that's fine.Secondly, I think this has something to do with the
await
desugaring, it also breaks the suggestion:It even fires without the Option, but that's kinda degenerate code:
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: