@@ -38,26 +38,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
38
38
return ;
39
39
}
40
40
41
- // `try_into` was added to the prelude in Rust 2021.
42
- // `into_iter` wasn't, but `[T; N].into_iter()` doesn't resolve to
43
- // IntoIterator::into_iter before Rust 2021, which results in the same
44
- // problem.
45
- if !matches ! ( segment. ident. name, sym:: try_into | sym:: into_iter) {
46
- return ;
47
- }
48
-
49
- let prelude_or_array_lint = if segment. ident . name == sym:: into_iter {
50
- // The `into_iter` problem is only a thing for arrays.
51
- if let Array ( ..) = self_ty. kind ( ) {
41
+ let prelude_or_array_lint = match segment. ident . name {
42
+ // `try_into` was added to the prelude in Rust 2021.
43
+ sym:: try_into => RUST_2021_PRELUDE_COLLISIONS ,
44
+ // `into_iter` wasn't added to the prelude,
45
+ // but `[T; N].into_iter()` doesn't resolve to IntoIterator::into_iter
46
+ // before Rust 2021, which results in the same problem.
47
+ // It is only a problem for arrays.
48
+ sym:: into_iter if let Array ( ..) = self_ty. kind ( ) => {
52
49
// In this case, it wasn't really a prelude addition that was the problem.
53
50
// Instead, the problem is that the array-into_iter hack will no longer apply in Rust 2021.
54
51
rustc_lint:: ARRAY_INTO_ITER
55
- } else {
56
- // No problem in this case.
57
- return ;
58
52
}
59
- } else {
60
- RUST_2021_PRELUDE_COLLISIONS
53
+ _ => return ,
61
54
} ;
62
55
63
56
// No need to lint if method came from std/core, as that will now be in the prelude
0 commit comments