Make span_suggestions take IntoIterator
This commit is contained in:
parent
fbce7decd8
commit
e807cb3c41
6 changed files with 11 additions and 11 deletions
|
@ -698,7 +698,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
),
|
),
|
||||||
(rv.span.shrink_to_hi(), ")".to_string()),
|
(rv.span.shrink_to_hi(), ")".to_string()),
|
||||||
],
|
],
|
||||||
].into_iter(),
|
],
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
);
|
);
|
||||||
self.suggested = true;
|
self.suggested = true;
|
||||||
|
|
|
@ -717,7 +717,7 @@ impl Diagnostic {
|
||||||
&mut self,
|
&mut self,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
suggestions: impl Iterator<Item = String>,
|
suggestions: impl IntoIterator<Item = String>,
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.span_suggestions_with_style(
|
self.span_suggestions_with_style(
|
||||||
|
@ -738,7 +738,7 @@ impl Diagnostic {
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
style: SuggestionStyle,
|
style: SuggestionStyle,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
let mut suggestions: Vec<_> = suggestions.collect();
|
let mut suggestions: Vec<_> = suggestions.into_iter().collect();
|
||||||
suggestions.sort();
|
suggestions.sort();
|
||||||
|
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
|
@ -765,7 +765,7 @@ impl Diagnostic {
|
||||||
pub fn multipart_suggestions(
|
pub fn multipart_suggestions(
|
||||||
&mut self,
|
&mut self,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
suggestions: impl Iterator<Item = Vec<(Span, String)>>,
|
suggestions: impl IntoIterator<Item = Vec<(Span, String)>>,
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
let suggestions: Vec<_> = suggestions.collect();
|
let suggestions: Vec<_> = suggestions.collect();
|
||||||
|
|
|
@ -599,13 +599,13 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
||||||
&mut self,
|
&mut self,
|
||||||
sp: Span,
|
sp: Span,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
suggestions: impl Iterator<Item = String>,
|
suggestions: impl IntoIterator<Item = String>,
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
) -> &mut Self);
|
) -> &mut Self);
|
||||||
forward!(pub fn multipart_suggestions(
|
forward!(pub fn multipart_suggestions(
|
||||||
&mut self,
|
&mut self,
|
||||||
msg: impl Into<SubdiagnosticMessage>,
|
msg: impl Into<SubdiagnosticMessage>,
|
||||||
suggestions: impl Iterator<Item = Vec<(Span, String)>>,
|
suggestions: impl IntoIterator<Item = Vec<(Span, String)>>,
|
||||||
applicability: Applicability,
|
applicability: Applicability,
|
||||||
) -> &mut Self);
|
) -> &mut Self);
|
||||||
forward!(pub fn span_suggestion_short(
|
forward!(pub fn span_suggestion_short(
|
||||||
|
|
|
@ -401,7 +401,7 @@ impl<'a> Parser<'a> {
|
||||||
.span_suggestions(
|
.span_suggestions(
|
||||||
span.shrink_to_hi(),
|
span.shrink_to_hi(),
|
||||||
"add `mut` or `const` here",
|
"add `mut` or `const` here",
|
||||||
["mut ".to_string(), "const ".to_string()].into_iter(),
|
["mut ".to_string(), "const ".to_string()],
|
||||||
Applicability::HasPlaceholders,
|
Applicability::HasPlaceholders,
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
|
|
|
@ -1941,7 +1941,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
err.span_suggestions(
|
err.span_suggestions(
|
||||||
span,
|
span,
|
||||||
&msg,
|
&msg,
|
||||||
suggestable_variants.into_iter(),
|
suggestable_variants,
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1995,7 +1995,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
err.span_suggestions(
|
err.span_suggestions(
|
||||||
span,
|
span,
|
||||||
msg,
|
msg,
|
||||||
suggestable_variants.into_iter(),
|
suggestable_variants,
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2025,7 +2025,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||||
err.span_suggestions(
|
err.span_suggestions(
|
||||||
span,
|
span,
|
||||||
msg,
|
msg,
|
||||||
suggestable_variants_with_placeholders.into_iter(),
|
suggestable_variants_with_placeholders,
|
||||||
Applicability::HasPlaceholders,
|
Applicability::HasPlaceholders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
err.span_suggestions(
|
err.span_suggestions(
|
||||||
span.shrink_to_lo(),
|
span.shrink_to_lo(),
|
||||||
"consider borrowing here",
|
"consider borrowing here",
|
||||||
["&".to_string(), "&mut ".to_string()].into_iter(),
|
["&".to_string(), "&mut ".to_string()],
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue