Rollup merge of #100970 - Xiretza:derive-multipart-suggestion, r=davidtwco
Allow deriving multipart suggestions This turned into a bit more of a rewrite than I was initially hoping for... Still, I think the `SessionSubdiagnostic` derive is a little cleaner overall now, and closer to the `SessionDiagnostic` derive to make future code sharing easier. r? ``@davidtwco``
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user