From d0e0ffa99f45ef07855c41ec0be30ca5496d8ba3 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Tue, 26 Nov 2019 14:14:28 +0000 Subject: make use of Result::map_or --- src/driver.rs | 3 ++- src/lintlist/mod.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index 2a4448cc0ec..2579fb4ad4d 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -1,4 +1,5 @@ #![cfg_attr(feature = "deny-warnings", deny(warnings))] +#![feature(result_map_or)] #![feature(rustc_private)] // FIXME: switch to something more ergonomic here, once available. @@ -319,7 +320,7 @@ pub fn main() { // this check ensures that dependencies are built but not linted and the final // crate is // linted but not built - let clippy_enabled = env::var("CLIPPY_TESTS").ok().map_or(false, |val| val == "true") + let clippy_enabled = env::var("CLIPPY_TESTS").map_or(false, |val| val == "true") || arg_value(&orig_args, "--emit", |val| val.split(',').any(|e| e == "metadata")).is_some(); if clippy_enabled { diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs index 9b258ffb610..715d505abf3 100644 --- a/src/lintlist/mod.rs +++ b/src/lintlist/mod.rs @@ -1697,7 +1697,7 @@ pub const ALL_LINTS: [Lint; 337] = [ Lint { name: "result_map_unwrap_or_else", group: "pedantic", - desc: "using `Result.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `.ok().map_or_else(g, f)`", + desc: "using `Result.map(f).unwrap_or_else(g)`, which is more succinctly expressed as `.map_or_else(g, f)`", deprecation: None, module: "methods", }, -- cgit 1.4.1-3-g733a5