Skip to content

Commit a262806

Browse files
committed
skip rustfmt for multiline test
1 parent 2683884 commit a262806

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

tests/ui/filter_map_next.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ fn main() {
66
let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next();
77
assert_eq!(element, Some(1));
88

9+
#[rustfmt::skip]
910
let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]
1011
.into_iter()
11-
.filter_map(|x| if x == 2 { Some(x * 2) } else { None })
12+
.filter_map(|x| {
13+
if x == 2 {
14+
Some(x * 2)
15+
} else {
16+
None
17+
}
18+
})
1219
.next();
1320
}

tests/ui/filter_map_next.stderr

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,31 @@ LL | let element: Option<i32> = a.iter().filter_map(|s| s.parse().ok()).next
88
= note: replace `filter_map(|s| s.parse().ok()).next()` with `find_map(|s| s.parse().ok())`
99

1010
error: called `filter_map(p).next()` on an `Iterator`. This is more succinctly expressed by calling `.find_map(p)` instead.
11-
--> $DIR/filter_map_next.rs:9:26
11+
--> $DIR/filter_map_next.rs:10:26
1212
|
1313
LL | let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]
1414
| __________________________^
1515
LL | | .into_iter()
16-
LL | | .filter_map(|x| if x == 2 { Some(x * 2) } else { None })
16+
LL | | .filter_map(|x| {
17+
LL | | if x == 2 {
18+
... |
19+
LL | | })
1720
LL | | .next();
1821
| |_______________^
1922
|
20-
= note: replace `filter_map(|x| if x == 2 { Some(x * 2) } else { None }).next()` with `find_map(|x| if x == 2 { Some(x * 2) } else { None })`
23+
= note: replace `filter_map(|x| {
24+
if x == 2 {
25+
Some(x * 2)
26+
} else {
27+
None
28+
}
29+
}).next()` with `find_map(|x| {
30+
if x == 2 {
31+
Some(x * 2)
32+
} else {
33+
None
34+
}
35+
})`
2136

2237
error: aborting due to 2 previous errors
2338

0 commit comments

Comments
 (0)