Skip to content

Commit 2fe5e2c

Browse files
committed
Update test
1 parent d578c43 commit 2fe5e2c

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

tests/ui/unnecessary_flat_map.fixed

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// run-rustfix
22

3+
#![allow(unused_imports)]
34
#![warn(clippy::flat_map_identity)]
45

56
use std::convert;
67

78
fn main() {
89
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
9-
iterator.flatten();
10+
let _ = iterator.flatten();
1011

1112
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
12-
iterator.flatten();
13+
let _ = iterator.flatten();
1314
}

tests/ui/unnecessary_flat_map.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// run-rustfix
22

3+
#![allow(unused_imports)]
34
#![warn(clippy::flat_map_identity)]
45

56
use std::convert;
67

78
fn main() {
89
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
9-
iterator.flat_map(|x| x);
10+
let _ = iterator.flat_map(|x| x);
1011

1112
let iterator = [[0, 1], [2, 3], [4, 5]].iter();
12-
iterator.flat_map(convert::identity);
13+
let _ = iterator.flat_map(convert::identity);
1314
}

tests/ui/unnecessary_flat_map.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error: called `flat_map(|x| x)` on an `Iterator`
2-
--> $DIR/unnecessary_flat_map.rs:9:14
2+
--> $DIR/unnecessary_flat_map.rs:10:22
33
|
4-
LL | iterator.flat_map(|x| x);
5-
| ^^^^^^^^^^^^^^^ help: try: `flatten()`
4+
LL | let _ = iterator.flat_map(|x| x);
5+
| ^^^^^^^^^^^^^^^ help: try: `flatten()`
66
|
77
= note: `-D clippy::flat-map-identity` implied by `-D warnings`
88

99
error: called `flat_map(std::convert::identity)` on an `Iterator`
10-
--> $DIR/unnecessary_flat_map.rs:12:14
10+
--> $DIR/unnecessary_flat_map.rs:13:22
1111
|
12-
LL | iterator.flat_map(convert::identity);
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()`
12+
LL | let _ = iterator.flat_map(convert::identity);
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()`
1414

1515
error: aborting due to 2 previous errors
1616

0 commit comments

Comments
 (0)