1
Fork 0

Have the drop code suggestion not include let _ =

This commit is contained in:
Aaron Kofsky 2022-06-11 10:36:48 -04:00
parent 7237e8635d
commit b040666e05
3 changed files with 5 additions and 5 deletions

View file

@ -157,7 +157,7 @@ fn build_and_emit_lint(
.multipart_suggestion( .multipart_suggestion(
"consider immediately dropping the value", "consider immediately dropping the value",
vec![ vec![
(init_span.shrink_to_lo(), "drop(".to_string()), (local.span.until(init_span), "drop(".to_string()),
(init_span.shrink_to_hi(), ")".to_string()), (init_span.shrink_to_hi(), ")".to_string()),
], ],
Applicability::MachineApplicable, Applicability::MachineApplicable,

View file

@ -11,8 +11,8 @@ LL | let _unused = NontrivialDrop;
| ~~~~~~~ | ~~~~~~~
help: consider immediately dropping the value help: consider immediately dropping the value
| |
LL | let _ = drop(NontrivialDrop); LL | drop(NontrivialDrop);
| +++++ + | ~~~~~ +
warning: 1 warning emitted warning: 1 warning emitted

View file

@ -11,8 +11,8 @@ LL | let _unused = data.lock().unwrap();
| ~~~~~~~ | ~~~~~~~
help: consider immediately dropping the value help: consider immediately dropping the value
| |
LL | let _ = drop(data.lock().unwrap()); LL | drop(data.lock().unwrap());
| +++++ + | ~~~~~ +
error: aborting due to previous error error: aborting due to previous error