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