]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/needless_collect_indirect.stderr
Auto merge of #6336 - giraffate:sync-from-rust, r=flip1995
[rust.git] / tests / ui / needless_collect_indirect.stderr
index 700c73b0b223dffebd66c7e065116c666b106ce1..fb807da5f8abee5b3339dcfffe92eb6e16532264 100644 (file)
@@ -1,5 +1,5 @@
 error: avoid using `collect()` when not needed
-  --> $DIR/needless_collect_indirect.rs:8:5
+  --> $DIR/needless_collect_indirect.rs:5:5
    |
 LL | /     let indirect_iter = sample.iter().collect::<Vec<_>>();
 LL | |     indirect_iter.into_iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
@@ -13,7 +13,7 @@ LL |     sample.iter().map(|x| (x, x + 1)).collect::<HashMap<_, _>>();
    |
 
 error: avoid using `collect()` when not needed
-  --> $DIR/needless_collect_indirect.rs:10:5
+  --> $DIR/needless_collect_indirect.rs:7:5
    |
 LL | /     let indirect_len = sample.iter().collect::<VecDeque<_>>();
 LL | |     indirect_len.len();
@@ -26,7 +26,7 @@ LL |     sample.iter().count();
    |
 
 error: avoid using `collect()` when not needed
-  --> $DIR/needless_collect_indirect.rs:12:5
+  --> $DIR/needless_collect_indirect.rs:9:5
    |
 LL | /     let indirect_empty = sample.iter().collect::<VecDeque<_>>();
 LL | |     indirect_empty.is_empty();
@@ -39,7 +39,7 @@ LL |     sample.iter().next().is_none();
    |
 
 error: avoid using `collect()` when not needed
-  --> $DIR/needless_collect_indirect.rs:14:5
+  --> $DIR/needless_collect_indirect.rs:11:5
    |
 LL | /     let indirect_contains = sample.iter().collect::<VecDeque<_>>();
 LL | |     indirect_contains.contains(&&5);
@@ -48,8 +48,21 @@ LL | |     indirect_contains.contains(&&5);
 help: Check if the original Iterator contains an element instead of collecting then checking
    |
 LL |     
-LL |     sample.iter().any(|x| x == &&5);
+LL |     sample.iter().any(|x| x == &5);
    |
 
-error: aborting due to 4 previous errors
+error: avoid using `collect()` when not needed
+  --> $DIR/needless_collect_indirect.rs:23:5
+   |
+LL | /     let non_copy_contains = sample.into_iter().collect::<Vec<_>>();
+LL | |     non_copy_contains.contains(&a);
+   | |____^
+   |
+help: Check if the original Iterator contains an element instead of collecting then checking
+   |
+LL |     
+LL |     sample.into_iter().any(|x| x == a);
+   |
+
+error: aborting due to 5 previous errors