Fix suggestions for missing return type lifetime parameters
This commit is contained in:
parent
e5f83d24ae
commit
439ef6d762
9 changed files with 513 additions and 150 deletions
|
@ -299,6 +299,30 @@ impl Diagnostic {
|
|||
self
|
||||
}
|
||||
|
||||
/// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
|
||||
pub fn multipart_suggestion_with_style(
|
||||
&mut self,
|
||||
msg: &str,
|
||||
suggestion: Vec<(Span, String)>,
|
||||
applicability: Applicability,
|
||||
style: SuggestionStyle,
|
||||
) -> &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,
|
||||
applicability,
|
||||
tool_metadata: Default::default(),
|
||||
});
|
||||
self
|
||||
}
|
||||
|
||||
/// Prints out a message with for a multipart suggestion without showing the suggested code.
|
||||
///
|
||||
/// This is intended to be used for suggestions that are obvious in what the changes need to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue