Reword suggestion messages.

This commit is contained in:
Aaron Kofsky 2022-06-11 10:19:53 -04:00
parent cdf6606066
commit 7237e8635d
3 changed files with 6 additions and 6 deletions

View file

@ -150,12 +150,12 @@ fn build_and_emit_lint(
lint.build(msg)
.span_suggestion_verbose(
local.pat.span,
"consider binding to an unused variable",
"consider binding to an unused variable to avoid immediately dropping the value",
"_unused",
Applicability::MachineApplicable,
)
.multipart_suggestion(
"consider explicitly droping with `std::mem::drop`",
"consider immediately dropping the value",
vec![
(init_span.shrink_to_lo(), "drop(".to_string()),
(init_span.shrink_to_hi(), ")".to_string()),

View file

@ -5,11 +5,11 @@ LL | let _ = NontrivialDrop;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: requested on the command line with `-W let-underscore-drop`
help: consider binding to an unused variable
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL | let _unused = NontrivialDrop;
| ~~~~~~~
help: consider explicitly droping with `std::mem::drop`
help: consider immediately dropping the value
|
LL | let _ = drop(NontrivialDrop);
| +++++ +

View file

@ -5,11 +5,11 @@ LL | let _ = data.lock().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(let_underscore_lock)]` on by default
help: consider binding to an unused variable
help: consider binding to an unused variable to avoid immediately dropping the value
|
LL | let _unused = data.lock().unwrap();
| ~~~~~~~
help: consider explicitly droping with `std::mem::drop`
help: consider immediately dropping the value
|
LL | let _ = drop(data.lock().unwrap());
| +++++ +