mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
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:
parent
e9e39fd081
commit
e3ec1d509e
@ -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))
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user