From 2448c7698ef186ead88bd7980f2cac28c55111a8 Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Mon, 10 May 2021 14:59:54 +0200 Subject: More minor fixes suggested by @jackh726 --- compiler/rustc_errors/src/diagnostic.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'compiler/rustc_errors/src') 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`]. -- cgit 1.4.1-3-g733a5