diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2022-08-22 13:38:08 +0200 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2022-08-30 09:46:42 +0200 |
| commit | 8af7f4208a789ba27a341c99df2de9c018b79828 (patch) | |
| tree | a6dbc73cae24a2413e3a4c873cc2f00b69e87e0d /compiler/rustc_errors/src | |
| parent | 9f4d5d2a28849ec0ecb2976ddc9946f65b626fe8 (diff) | |
| download | rust-8af7f4208a789ba27a341c99df2de9c018b79828.tar.gz rust-8af7f4208a789ba27a341c99df2de9c018b79828.zip | |
Code deduplication in tool_only_multipart_suggestion
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 506198df4d8..f75e2596f36 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -686,19 +686,12 @@ impl Diagnostic { suggestion: Vec<(Span, String)>, applicability: Applicability, ) -> &mut Self { - assert!(!suggestion.is_empty()); - self.push_suggestion(CodeSuggestion { - substitutions: vec![Substitution { - parts: suggestion - .into_iter() - .map(|(span, snippet)| SubstitutionPart { snippet, span }) - .collect(), - }], - msg: self.subdiagnostic_message_to_diagnostic_message(msg), - style: SuggestionStyle::CompletelyHidden, + self.multipart_suggestion_with_style( + msg, + suggestion, applicability, - }); - self + SuggestionStyle::CompletelyHidden, + ) } /// Prints out a message with a suggested edit of the code. |
