]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/single_element_loop.rs
Rollup merge of #94831 - yaahc:lib-tracking-issue-template-update, r=JohnTitor
[rust.git] / src / tools / clippy / tests / ui / single_element_loop.rs
1 // run-rustfix
2 // Tests from for_loop.rs that don't have suggestions
3
4 #[warn(clippy::single_element_loop)]
5 fn main() {
6     let item1 = 2;
7     for item in &[item1] {
8         dbg!(item);
9     }
10
11     for item in [item1].iter() {
12         dbg!(item);
13     }
14
15     for item in &[0..5] {
16         dbg!(item);
17     }
18
19     for item in [0..5].iter_mut() {
20         dbg!(item);
21     }
22
23     for item in [0..5] {
24         dbg!(item);
25     }
26
27     for item in [0..5].into_iter() {
28         dbg!(item);
29     }
30 }