Skip to content

Commit 90080f4

Browse files
committed
Don't give invalid suggestions in array_into_iter.
1 parent 422ad3b commit 90080f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_lint/src/array_into_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
141141
String::new(),
142142
Applicability::MaybeIncorrect,
143143
);
144-
} else {
144+
} else if receiver_ty.is_array() {
145145
diag.multipart_suggestion(
146146
"or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value",
147147
vec![

0 commit comments

Comments
 (0)