Add new suggestion to array_into_iter lint.
This commit is contained in:
parent
37e17803b5
commit
5cfe2a5fc6
1 changed files with 8 additions and 0 deletions
|
@ -110,6 +110,14 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
|
||||||
"iter".into(),
|
"iter".into(),
|
||||||
Applicability::MachineApplicable,
|
Applicability::MachineApplicable,
|
||||||
)
|
)
|
||||||
|
.multipart_suggestion(
|
||||||
|
"or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value",
|
||||||
|
vec![
|
||||||
|
(expr.span.shrink_to_lo(), "IntoIterator::into_iter(".into()),
|
||||||
|
(receiver_arg.span.shrink_to_hi().to(expr.span.shrink_to_hi()), ")".into()),
|
||||||
|
],
|
||||||
|
Applicability::MaybeIncorrect,
|
||||||
|
)
|
||||||
.emit();
|
.emit();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue