1
Fork 0

Code deduplication in tool_only_multipart_suggestion

This commit is contained in:
Xiretza 2022-08-22 13:38:08 +02:00
parent 9f4d5d2a28
commit 8af7f4208a

View file

@ -686,19 +686,12 @@ impl Diagnostic {
suggestion: Vec<(Span, String)>, suggestion: Vec<(Span, String)>,
applicability: Applicability, applicability: Applicability,
) -> &mut Self { ) -> &mut Self {
assert!(!suggestion.is_empty()); self.multipart_suggestion_with_style(
self.push_suggestion(CodeSuggestion { msg,
substitutions: vec![Substitution { suggestion,
parts: suggestion
.into_iter()
.map(|(span, snippet)| SubstitutionPart { snippet, span })
.collect(),
}],
msg: self.subdiagnostic_message_to_diagnostic_message(msg),
style: SuggestionStyle::CompletelyHidden,
applicability, applicability,
}); SuggestionStyle::CompletelyHidden,
self )
} }
/// Prints out a message with a suggested edit of the code. /// Prints out a message with a suggested edit of the code.