about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorAaron Kofsky <aaronko@umich.edu>2022-06-09 14:03:35 -0400
committerAaron Kofsky <aaronko@umich.edu>2022-06-09 14:03:35 -0400
commitcdf66060666fa53cbca9647ac7434bdfd2cc37a5 (patch)
tree6a1ca4eabff569c136d91778f33a5afdd9117218 /compiler
parent211feb106a188fef698bb36d19402808f9930154 (diff)
downloadrust-cdf66060666fa53cbca9647ac7434bdfd2cc37a5.tar.gz
rust-cdf66060666fa53cbca9647ac7434bdfd2cc37a5.zip
Use `multipart_suggestion` to create an applicable suggestion.
The "consider explicitly droping" can now suggest a machine applicable
suggestion now.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/let_underscore.rs10
1 files changed, 6 insertions, 4 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();
 }