Have the drop code suggestion not include let _ =
This commit is contained in:
parent
7237e8635d
commit
b040666e05
3 changed files with 5 additions and 5 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue