From e3ec1d509ea2fafdf1287c84fe4bae43bfe06166 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 17 Dec 2020 16:30:10 +1100 Subject: [PATCH] agent: Simplify .or_else() to .or() get_bool_value() in src/agent/src/config.rs includes a Result::or_else() call with a trivial closure which can be replaced by a Result::or. This removes a clippy warning. fixes #1201 Signed-off-by: David Gibson --- src/agent/src/config.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/agent/src/config.rs b/src/agent/src/config.rs index 3788bb8bf7..8cf4e021b7 100644 --- a/src/agent/src/config.rs +++ b/src/agent/src/config.rs @@ -234,9 +234,7 @@ fn get_bool_value(param: &str) -> Result { // first try to parse as bool value v.parse::().or_else(|_err1| { // then try to parse as integer value - v.parse::() - .or_else(|_err2| Ok(0)) - .map(|v| !matches!(v, 0)) + v.parse::().or(Ok(0)).map(|v| !matches!(v, 0)) }) }