clippy: convert single match to if let

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 12:09:33 +01:00
parent ea368a06cd
commit b92cad0938
7 changed files with 66 additions and 88 deletions

View File

@ -35,13 +35,10 @@ use crate::api2::types::{Authid, APTUpdateInfo, NODE_SCHEMA, UPID_SCHEMA};
/// List available APT updates
fn apt_update_available(_param: Value) -> Result<Value, Error> {
match apt::pkg_cache_expired() {
Ok(false) => {
if let Ok(Some(cache)) = apt::read_pkg_state() {
return Ok(json!(cache.package_status));
}
},
_ => (),
if let Ok(false) = apt::pkg_cache_expired() {
if let Ok(Some(cache)) = apt::read_pkg_state() {
return Ok(json!(cache.package_status));
}
}
let cache = apt::update_cache()?;