Skip to content

Commit

Permalink
somehow local formatting differs from CI; format
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Loren committed Mar 30, 2021
1 parent 9edd59e commit 370c0a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
6 changes: 1 addition & 5 deletions tests/ui/option_filter_map.fixed
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#![warn(clippy::option_filter_map)]
// run-rustfix
fn odds_out(x: i32) -> Option<i32> {
if x % 2 == 0 {
Some(x)
} else {
None
}
if x % 2 == 0 { Some(x) } else { None }
}

fn main() {
Expand Down
6 changes: 1 addition & 5 deletions tests/ui/option_filter_map.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#![warn(clippy::option_filter_map)]
// run-rustfix
fn odds_out(x: i32) -> Option<i32> {
if x % 2 == 0 {
Some(x)
} else {
None
}
if x % 2 == 0 { Some(x) } else { None }
}

fn main() {
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/option_filter_map.stderr
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
error: `filter` for `Some` followed by `unwrap`
--> $DIR/option_filter_map.rs:12:13
--> $DIR/option_filter_map.rs:8:13
|
LL | let _ = Some(Some(1)).filter(Option::is_some).map(Option::unwrap);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `flatten` instead: `Some(Some(1)).flatten()`
|
= note: `-D clippy::option-filter-map` implied by `-D warnings`

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

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

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

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

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

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

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

0 comments on commit 370c0a1

Please sign in to comment.