diff options
| -rw-r--r-- | compiler/rustc_lint/src/let_underscore.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/lint/let_underscore/let_underscore_drop.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/lint/let_underscore/let_underscore_lock.stderr | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_lint/src/let_underscore.rs b/compiler/rustc_lint/src/let_underscore.rs index 520c865cc19..18661e8c505 100644 --- a/compiler/rustc_lint/src/let_underscore.rs +++ b/compiler/rustc_lint/src/let_underscore.rs @@ -154,11 +154,13 @@ fn build_and_emit_lint( "_unused", Applicability::MachineApplicable, ) - .span_suggestion_verbose( - init_span, + .multipart_suggestion( "consider explicitly droping with `std::mem::drop`", - "drop(...)", - Applicability::HasPlaceholders, + vec![ + (init_span.shrink_to_lo(), "drop(".to_string()), + (init_span.shrink_to_hi(), ")".to_string()), + ], + Applicability::MachineApplicable, ) .emit(); } diff --git a/src/test/ui/lint/let_underscore/let_underscore_drop.stderr b/src/test/ui/lint/let_underscore/let_underscore_drop.stderr index 5034f682bb7..dfac6d3f741 100644 --- a/src/test/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/src/test/ui/lint/let_underscore/let_underscore_drop.stderr @@ -11,8 +11,8 @@ LL | let _unused = NontrivialDrop; | ~~~~~~~ help: consider explicitly droping with `std::mem::drop` | -LL | let _ = drop(...); - | ~~~~~~~~~ +LL | let _ = drop(NontrivialDrop); + | +++++ + warning: 1 warning emitted diff --git a/src/test/ui/lint/let_underscore/let_underscore_lock.stderr b/src/test/ui/lint/let_underscore/let_underscore_lock.stderr index 7ff42cb1524..f37483ddd96 100644 --- a/src/test/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/src/test/ui/lint/let_underscore/let_underscore_lock.stderr @@ -11,8 +11,8 @@ LL | let _unused = data.lock().unwrap(); | ~~~~~~~ help: consider explicitly droping with `std::mem::drop` | -LL | let _ = drop(...); - | ~~~~~~~~~ +LL | let _ = drop(data.lock().unwrap()); + | +++++ + error: aborting due to previous error |
