Have the drop code suggestion not include let _ =
This commit is contained in:
parent
7237e8635d
commit
b040666e05
@ -157,7 +157,7 @@ fn build_and_emit_lint(
|
||||
.multipart_suggestion(
|
||||
"consider immediately dropping the value",
|
||||
vec![
|
||||
(init_span.shrink_to_lo(), "drop(".to_string()),
|
||||
(local.span.until(init_span), "drop(".to_string()),
|
||||
(init_span.shrink_to_hi(), ")".to_string()),
|
||||
],
|
||||
Applicability::MachineApplicable,
|
||||
|
@ -11,8 +11,8 @@ LL | let _unused = NontrivialDrop;
|
||||
| ~~~~~~~
|
||||
help: consider immediately dropping the value
|
||||
|
|
||||
LL | let _ = drop(NontrivialDrop);
|
||||
| +++++ +
|
||||
LL | drop(NontrivialDrop);
|
||||
| ~~~~~ +
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
@ -11,8 +11,8 @@ LL | let _unused = data.lock().unwrap();
|
||||
| ~~~~~~~
|
||||
help: consider immediately dropping the value
|
||||
|
|
||||
LL | let _ = drop(data.lock().unwrap());
|
||||
| +++++ +
|
||||
LL | drop(data.lock().unwrap());
|
||||
| ~~~~~ +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user