]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/for_loop_fixable.fixed
iterate List by value
[rust.git] / tests / ui / for_loop_fixable.fixed
index 6717899ed090ca3c8c75eac2def6dcfec5ee60f2..249a88a0b3982cdccb57fa64418d5831d54c9c33 100644 (file)
@@ -21,73 +21,18 @@ impl Unrelated {
     clippy::explicit_iter_loop,
     clippy::explicit_into_iter_loop,
     clippy::iter_next_loop,
-    clippy::reverse_range_loop,
     clippy::for_kv_map
 )]
 #[allow(
     clippy::linkedlist,
     clippy::shadow_unrelated,
     clippy::unnecessary_mut_passed,
-    clippy::cognitive_complexity,
     clippy::similar_names
 )]
 #[allow(clippy::many_single_char_names, unused_variables)]
 fn main() {
-    const MAX_LEN: usize = 42;
     let mut vec = vec![1, 2, 3, 4];
 
-    for i in (0..10).rev() {
-        println!("{}", i);
-    }
-
-    for i in (0..=10).rev() {
-        println!("{}", i);
-    }
-
-    for i in (0..MAX_LEN).rev() {
-        println!("{}", i);
-    }
-
-    for i in 5..=5 {
-        // not an error, this is the range with only one element “5”
-        println!("{}", i);
-    }
-
-    for i in 0..10 {
-        // not an error, the start index is less than the end index
-        println!("{}", i);
-    }
-
-    for i in -10..0 {
-        // not an error
-        println!("{}", i);
-    }
-
-    for i in (10..0).map(|x| x * 2) {
-        // not an error, it can't be known what arbitrary methods do to a range
-        println!("{}", i);
-    }
-
-    // testing that the empty range lint folds constants
-    for i in (5 + 4..10).rev() {
-        println!("{}", i);
-    }
-
-    for i in ((3 - 1)..(5 + 2)).rev() {
-        println!("{}", i);
-    }
-
-    for i in (2 * 2)..(2 * 3) {
-        // no error, 4..6 is fine
-        println!("{}", i);
-    }
-
-    let x = 42;
-    for i in x..10 {
-        // no error, not constant-foldable
-        println!("{}", i);
-    }
-
     // See #601
     for i in 0..10 {
         // no error, id_col does not exist outside the loop