Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ldm0 committed Mar 1, 2022
1 parent c216df3 commit a176d11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions tests/ui/iter_with_drain.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// run-rustfix
// will emits unused mut warnings after fixing
#![allow(unused_mut)]
// will emits needless collect warnings after fixing
#![allow(clippy::needless_collect)]
#![warn(clippy::iter_with_drain)]
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};

Expand Down
12 changes: 6 additions & 6 deletions tests/ui/iter_with_drain.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:6:34
--> $DIR/iter_with_drain.rs:11:34
|
LL | let mut a: BinaryHeap<_> = a.drain(..).collect();
| ^^^^^^^^^ help: try this: `into_iter()`
|
= note: `-D clippy::iter-with-drain` implied by `-D warnings`

error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:9:27
--> $DIR/iter_with_drain.rs:14:27
|
LL | let mut a: Vec<_> = a.drain(..).collect();
| ^^^^^^^^^ help: try this: `into_iter()`

error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:10:34
--> $DIR/iter_with_drain.rs:15:34
|
LL | let mut a: HashMap<_, _> = a.drain(..).map(|x| (x.clone(), x)).collect();
| ^^^^^^^^^ help: try this: `into_iter()`

error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:16:34
--> $DIR/iter_with_drain.rs:21:34
|
LL | let mut a: BinaryHeap<_> = a.drain(0..).collect();
| ^^^^^^^^^^ help: try this: `into_iter()`

error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:19:27
--> $DIR/iter_with_drain.rs:24:27
|
LL | let mut a: Vec<_> = a.drain(..a.len()).collect();
| ^^^^^^^^^^^^^^^^ help: try this: `into_iter()`

error: use `into_iter` instead of `drain` for iterating all elements by value in a container
--> $DIR/iter_with_drain.rs:20:34
--> $DIR/iter_with_drain.rs:25:34
|
LL | let mut a: HashMap<_, _> = a.drain(0..a.len()).map(|x| (x.clone(), x)).collect();
| ^^^^^^^^^^^^^^^^^ help: try this: `into_iter()`
Expand Down

0 comments on commit a176d11

Please sign in to comment.