diff options
| author | Fabian Wolff <fabi.wolff@arcor.de> | 2021-05-10 14:59:54 +0200 |
|---|---|---|
| committer | Fabian Wolff <fabi.wolff@arcor.de> | 2021-05-10 15:02:15 +0200 |
| commit | 2448c7698ef186ead88bd7980f2cac28c55111a8 (patch) | |
| tree | 02b928a543aaab1a27635b9147e5d9575aa26668 /compiler/rustc_errors/src | |
| parent | 3c0c3874fc75c730efba0702579bfeef34eecf31 (diff) | |
| download | rust-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.rs | 18 |
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`]. |
