Code deduplication in tool_only_multipart_suggestion
This commit is contained in:
parent
9f4d5d2a28
commit
8af7f4208a
1 changed files with 5 additions and 12 deletions
|
@ -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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue