Allow option_and_then_some in option_map_or_none test

This commit is contained in:
Lzu Tao 2019-08-16 09:42:07 +07:00
parent 7065239da5
commit 50ecd595a6
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
// run-rustfix
#![allow(clippy::option_and_then_some)]
fn main() {
let opt = Some(1);

View File

@ -1,5 +1,7 @@
// run-rustfix
#![allow(clippy::option_and_then_some)]
fn main() {
let opt = Some(1);

View File

@ -1,5 +1,5 @@
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))`
@ -7,7 +7,7 @@ LL | let _ = opt.map_or(None, |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| {
| _____________^