Clippy suggests dropping a temporary with a significant Drop after another function has taken ownership of it. Implementing its suggestion leads to an error.
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
note: the lint level is defined here
--> src/main.rs:1:8
|
1 | #[warn(clippy::significant_drop_tightening)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: drop the temporary after the end of its last usage
|
6 ~ other_function(lock);
7 + drop(lock);
|
warning: `rust-bug-reports` (bin "rust-bug-reports") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Summary
Clippy suggests dropping a temporary with a significant
Drop
after another function has taken ownership of it. Implementing its suggestion leads to an error.Lint Name
significant_drop_tightening
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
Version
Additional Labels
@rustbot label +I-suggestion-causes-error