You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let long_title1 ="this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021";
3589
+
let long_title2 = "for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>";
3590
+
let long_title3 = "or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value";
.element(Level::WARNING.message("this changes meaning in Rust 2021"))
3601
+
.element(Level::NOTE.message(long_title2))
3602
+
.element(Level::NOTE.message("`#[warn(array_into_iter)]` on by default")),
3603
+
Level::HELP
3604
+
.secondary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity")
3605
+
.element(
3606
+
Snippet::source(source)
3607
+
.path("lint_example.rs")
3608
+
.line_start(3)
3609
+
.patch(Patch::new(40..49,"iter")),
3610
+
),
3611
+
Level::HELP.secondary_title(long_title3).element(
3612
+
Snippet::source(source)
3613
+
.path("lint_example.rs")
3614
+
.line_start(3)
3615
+
.patch(Patch::new(74..74," // Span after line end")),
3616
+
),
3617
+
];
3618
+
3619
+
let expected_ascii = str![[r#"
3620
+
warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021
3621
+
--> lint_example.rs:3:11
3622
+
|
3623
+
3 | [1, 2, 3].into_iter().for_each(|n| { *n; });
3624
+
| ^^^^^^^^^
3625
+
|
3626
+
= warning: this changes meaning in Rust 2021
3627
+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
3628
+
= note: `#[warn(array_into_iter)]` on by default
3629
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
3630
+
|
3631
+
5 - [1, 2, 3].into_iter().for_each(|n| { *n; });
3632
+
5 + [1, 2, 3].iter().for_each(|n| { *n; });
3633
+
|
3634
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
3635
+
|
3636
+
5 | [1, 2, 3].into_iter().for_each(|n| { *n; }); // Span after line end
warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021
3644
+
╭▸ lint_example.rs:3:11
3645
+
│
3646
+
3 │ [1, 2, 3].into_iter().for_each(|n| { *n; });
3647
+
│ ━━━━━━━━━
3648
+
│
3649
+
├ warning: this changes meaning in Rust 2021
3650
+
├ note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
3651
+
╰ note: `#[warn(array_into_iter)]` on by default
3652
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
3653
+
╭╴
3654
+
5 - [1, 2, 3].into_iter().for_each(|n| { *n; });
3655
+
5 + [1, 2, 3].iter().for_each(|n| { *n; });
3656
+
╰╴
3657
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
3658
+
╭╴
3659
+
5 │ [1, 2, 3].into_iter().for_each(|n| { *n; }); // Span after line end
3660
+
╰╴ ++++++++++++++++++++++
3661
+
"#]];
3662
+
let renderer = renderer.decor_style(DecorStyle::Unicode);
let suggestion_source = r#"[1, 2, 3].into_iter().for_each(|n| { *n; });
3675
+
"#;
3676
+
3677
+
let long_title1 ="this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021";
3678
+
let long_title2 = "for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>";
3679
+
let long_title3 = "or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value";
.element(Level::WARNING.message("this changes meaning in Rust 2021"))
3690
+
.element(Level::NOTE.message(long_title2))
3691
+
.element(Level::NOTE.message("`#[warn(array_into_iter)]` on by default")),
3692
+
Level::HELP
3693
+
.secondary_title("use `.iter()` instead of `.into_iter()` to avoid ambiguity")
3694
+
.element(
3695
+
Snippet::source(suggestion_source)
3696
+
.path("lint_example.rs")
3697
+
.line_start(3)
3698
+
.patch(Patch::new(10..19,"iter")),
3699
+
),
3700
+
Level::HELP.secondary_title(long_title3).element(
3701
+
Snippet::source(suggestion_source)
3702
+
.path("lint_example.rs")
3703
+
.line_start(3)
3704
+
.patch(Patch::new(
3705
+
suggestion_source.len()..suggestion_source.len(),
3706
+
" // Span after line end",
3707
+
)),
3708
+
),
3709
+
];
3710
+
3711
+
let expected_ascii = str![[r#"
3712
+
warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021
3713
+
--> lint_example.rs:3:11
3714
+
|
3715
+
3 | [1, 2, 3].into_iter().for_each(|n| { *n; });
3716
+
| ^^^^^^^^^
3717
+
|
3718
+
= warning: this changes meaning in Rust 2021
3719
+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
3720
+
= note: `#[warn(array_into_iter)]` on by default
3721
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
3722
+
|
3723
+
3 - [1, 2, 3].into_iter().for_each(|n| { *n; });
3724
+
3 + [1, 2, 3].iter().for_each(|n| { *n; });
3725
+
|
3726
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
3727
+
|
3728
+
3 | [1, 2, 3].into_iter().for_each(|n| { *n; }); // Span after line end
warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021
3736
+
╭▸ lint_example.rs:3:11
3737
+
│
3738
+
3 │ [1, 2, 3].into_iter().for_each(|n| { *n; });
3739
+
│ ━━━━━━━━━
3740
+
│
3741
+
├ warning: this changes meaning in Rust 2021
3742
+
├ note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/IntoIterator-for-arrays.html>
3743
+
╰ note: `#[warn(array_into_iter)]` on by default
3744
+
help: use `.iter()` instead of `.into_iter()` to avoid ambiguity
3745
+
╭╴
3746
+
3 - [1, 2, 3].into_iter().for_each(|n| { *n; });
3747
+
3 + [1, 2, 3].iter().for_each(|n| { *n; });
3748
+
╰╴
3749
+
help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value
3750
+
╭╴
3751
+
3 │ [1, 2, 3].into_iter().for_each(|n| { *n; }); // Span after line end
3752
+
╰╴ ++++++++++++++++++++++
3753
+
"#]];
3754
+
let renderer = renderer.decor_style(DecorStyle::Unicode);
0 commit comments