Use smaller spans for some structured suggestions
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
This commit is contained in:
parent
eb2226b1f1
commit
34d19634f5
60 changed files with 1200 additions and 958 deletions
|
@ -298,6 +298,21 @@ impl Diagnostic {
|
|||
)
|
||||
}
|
||||
|
||||
/// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
|
||||
/// In other words, multiple changes need to be applied as part of this suggestion.
|
||||
pub fn multipart_suggestion_verbose(
|
||||
&mut self,
|
||||
msg: &str,
|
||||
suggestion: Vec<(Span, String)>,
|
||||
applicability: Applicability,
|
||||
) -> &mut Self {
|
||||
self.multipart_suggestion_with_style(
|
||||
msg,
|
||||
suggestion,
|
||||
applicability,
|
||||
SuggestionStyle::ShowAlways,
|
||||
)
|
||||
}
|
||||
/// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
|
||||
pub fn multipart_suggestion_with_style(
|
||||
&mut self,
|
||||
|
|
|
@ -257,6 +257,20 @@ impl<'a> DiagnosticBuilder<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
/// See [`Diagnostic::multipart_suggestion()`].
|
||||
pub fn multipart_suggestion_verbose(
|
||||
&mut self,
|
||||
msg: &str,
|
||||
suggestion: Vec<(Span, String)>,
|
||||
applicability: Applicability,
|
||||
) -> &mut Self {
|
||||
if !self.0.allow_suggestions {
|
||||
return self;
|
||||
}
|
||||
self.0.diagnostic.multipart_suggestion_verbose(msg, suggestion, applicability);
|
||||
self
|
||||
}
|
||||
|
||||
/// See [`Diagnostic::tool_only_multipart_suggestion()`].
|
||||
pub fn tool_only_multipart_suggestion(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue