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 <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2020-12-17 16:30:10 +11:00
parent e9e39fd081
commit e3ec1d509e

View File

@ -234,9 +234,7 @@ fn get_bool_value(param: &str) -> Result<bool> {
// first try to parse as bool value
v.parse::<bool>().or_else(|_err1| {
// then try to parse as integer value
v.parse::<u64>()
.or_else(|_err2| Ok(0))
.map(|v| !matches!(v, 0))
v.parse::<u64>().or(Ok(0)).map(|v| !matches!(v, 0))
})
}