Skip to content

Commit 9061e10

Browse files
author
Eric Loren
committed
somehow local formatting differs from CI; format
1 parent 05f8b58 commit 9061e10

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

tests/ui/option_filter_map.fixed

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#![warn(clippy::option_filter_map)]
22
// run-rustfix
33
fn odds_out(x: i32) -> Option<i32> {
4-
if x % 2 == 0 {
5-
Some(x)
6-
} else {
7-
None
8-
}
4+
if x % 2 == 0 { Some(x) } else { None }
95
}
106

117
fn main() {

tests/ui/option_filter_map.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#![warn(clippy::option_filter_map)]
22
// run-rustfix
33
fn odds_out(x: i32) -> Option<i32> {
4-
if x % 2 == 0 {
5-
Some(x)
6-
} else {
7-
None
8-
}
4+
if x % 2 == 0 { Some(x) } else { None }
95
}
106

117
fn main() {

tests/ui/option_filter_map.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
error: `filter` for `Some` followed by `unwrap`
2-
--> $DIR/option_filter_map.rs:12:13
2+
--> $DIR/option_filter_map.rs:8:13
33
|
44
LL | let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `Some(Some(1)).flatten()`
66
|
77
= note: `-D clippy::option-filter-map` implied by `-D warnings`
88

99
error: `filter` for `Some` followed by `unwrap`
10-
--> $DIR/option_filter_map.rs:13:13
10+
--> $DIR/option_filter_map.rs:9:13
1111
|
1212
LL | let _ = Some(Some(1)).filter(|o| o.is_some()).map(|o| o.unwrap());
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `Some(Some(1)).flatten()`
1414

1515
error: `filter` for `Some` followed by `unwrap`
16-
--> $DIR/option_filter_map.rs:14:13
16+
--> $DIR/option_filter_map.rs:10:13
1717
|
1818
LL | let _ = Some(1).map(odds_out).filter(Option::is_some).map(Option::unwrap);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `Some(1).map(odds_out).flatten()`
2020

2121
error: `filter` for `Some` followed by `unwrap`
22-
--> $DIR/option_filter_map.rs:15:13
22+
--> $DIR/option_filter_map.rs:11:13
2323
|
2424
LL | let _ = Some(1).map(odds_out).filter(|o| o.is_some()).map(|o| o.unwrap());
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `Some(1).map(odds_out).flatten()`
2626

2727
error: `filter` for `Some` followed by `unwrap`
28-
--> $DIR/option_filter_map.rs:17:13
28+
--> $DIR/option_filter_map.rs:13:13
2929
|
3030
LL | let _ = vec![Some(1)].into_iter().filter(Option::is_some).map(Option::unwrap);
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `vec![Some(1)].into_iter().flatten()`
3232

3333
error: `filter` for `Some` followed by `unwrap`
34-
--> $DIR/option_filter_map.rs:18:13
34+
--> $DIR/option_filter_map.rs:14:13
3535
|
3636
LL | let _ = vec![Some(1)].into_iter().filter(|o| o.is_some()).map(|o| o.unwrap());
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `vec![Some(1)].into_iter().flatten()`
3838

3939
error: `filter` for `Some` followed by `unwrap`
40-
--> $DIR/option_filter_map.rs:19:13
40+
--> $DIR/option_filter_map.rs:15:13
4141
|
4242
LL | let _ = vec![1]
4343
| _____________^
@@ -55,7 +55,7 @@ LL | .map(odds_out).flatten();
5555
|
5656

5757
error: `filter` for `Some` followed by `unwrap`
58-
--> $DIR/option_filter_map.rs:24:13
58+
--> $DIR/option_filter_map.rs:20:13
5959
|
6060
LL | let _ = vec![1]
6161
| _____________^

0 commit comments

Comments
 (0)