about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorFabian Wolff <fabi.wolff@arcor.de>2021-05-10 14:59:54 +0200
committerFabian Wolff <fabi.wolff@arcor.de>2021-05-10 15:02:15 +0200
commit2448c7698ef186ead88bd7980f2cac28c55111a8 (patch)
tree02b928a543aaab1a27635b9147e5d9575aa26668 /compiler/rustc_errors/src
parent3c0c3874fc75c730efba0702579bfeef34eecf31 (diff)
downloadrust-2448c7698ef186ead88bd7980f2cac28c55111a8.tar.gz
rust-2448c7698ef186ead88bd7980f2cac28c55111a8.zip
More minor fixes suggested by @jackh726
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 405dd2e68c6..14ccced2c6a 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -283,20 +283,12 @@ impl Diagnostic {
         suggestion: Vec<(Span, String)>,
         applicability: Applicability,
     ) -> &mut Self {
-        assert!(!suggestion.is_empty());
-        self.suggestions.push(CodeSuggestion {
-            substitutions: vec![Substitution {
-                parts: suggestion
-                    .into_iter()
-                    .map(|(span, snippet)| SubstitutionPart { snippet, span })
-                    .collect(),
-            }],
-            msg: msg.to_owned(),
-            style: SuggestionStyle::ShowCode,
+        self.multipart_suggestion_with_style(
+            msg,
+            suggestion,
             applicability,
-            tool_metadata: Default::default(),
-        });
-        self
+            SuggestionStyle::ShowCode,
+        )
     }
 
     /// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].