Skip to content

Commit

Permalink
Allow option_and_then_some in option_map_or_none test
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Aug 18, 2019
1 parent 20f47a4 commit 3922094
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/ui/option_map_or_none.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// run-rustfix

#![allow(clippy::option_and_then_some)]

fn main() {
let opt = Some(1);

Expand Down
2 changes: 2 additions & 0 deletions tests/ui/option_map_or_none.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// run-rustfix

#![allow(clippy::option_and_then_some)]

fn main() {
let opt = Some(1);

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/option_map_or_none.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
--> $DIR/option_map_or_none.rs:8:13
--> $DIR/option_map_or_none.rs:10:13
|
LL | let _ = opt.map_or(None, |x| Some(x + 1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using and_then instead: `opt.and_then(|x| Some(x + 1))`
|
= note: `-D clippy::option-map-or-none` implied by `-D warnings`

error: called `map_or(None, f)` on an Option value. This can be done more directly by calling `and_then(f)` instead
--> $DIR/option_map_or_none.rs:11:13
--> $DIR/option_map_or_none.rs:13:13
|
LL | let _ = opt.map_or(None, |x| {
| _____________^
Expand Down

0 comments on commit 3922094

Please sign in to comment.