From 39220945ac8ecc0feb4685644156222bce15e556 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Aug 2019 09:42:07 +0700 Subject: [PATCH] Allow option_and_then_some in option_map_or_none test --- tests/ui/option_map_or_none.fixed | 2 ++ tests/ui/option_map_or_none.rs | 2 ++ tests/ui/option_map_or_none.stderr | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/ui/option_map_or_none.fixed b/tests/ui/option_map_or_none.fixed index e637f973c2ea..decbae4e5af9 100644 --- a/tests/ui/option_map_or_none.fixed +++ b/tests/ui/option_map_or_none.fixed @@ -1,5 +1,7 @@ // run-rustfix +#![allow(clippy::option_and_then_some)] + fn main() { let opt = Some(1); diff --git a/tests/ui/option_map_or_none.rs b/tests/ui/option_map_or_none.rs index 4b9b247880a0..0f1d2218d5d3 100644 --- a/tests/ui/option_map_or_none.rs +++ b/tests/ui/option_map_or_none.rs @@ -1,5 +1,7 @@ // run-rustfix +#![allow(clippy::option_and_then_some)] + fn main() { let opt = Some(1); diff --git a/tests/ui/option_map_or_none.stderr b/tests/ui/option_map_or_none.stderr index 66ed1e9f0451..eb5c68ed79f3 100644 --- a/tests/ui/option_map_or_none.stderr +++ b/tests/ui/option_map_or_none.stderr @@ -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| { | _____________^