more clippy lints

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-10-14 14:22:38 +02:00
parent 4c0ae82e23
commit 2081327428
7 changed files with 33 additions and 31 deletions

View File

@ -164,8 +164,8 @@ fn list_groups(
let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0; let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0;
let owner = datastore.get_owner(group)?; let owner = datastore.get_owner(group)?;
if !list_all { if !list_all && owner != userid {
if owner != userid { continue; } continue;
} }
let result_item = GroupListItem { let result_item = GroupListItem {
@ -355,8 +355,8 @@ pub fn list_snapshots (
let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0; let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0;
let owner = datastore.get_owner(group)?; let owner = datastore.get_owner(group)?;
if !list_all { if !list_all && owner != userid {
if owner != userid { continue; } continue;
} }
let mut size = None; let mut size = None;

View File

@ -31,11 +31,9 @@ pub fn create_value_from_rrd(
} else { } else {
result.push(json!({ "time": t })); result.push(json!({ "time": t }));
} }
} else { } else if let Some(value) = list[index] {
if let Some(value) = list[index] {
result[index][name] = value.into(); result[index][name] = value.into();
} }
}
t += reso; t += reso;
} }
} }

View File

@ -531,9 +531,7 @@ pub async fn pull_store(
item.backup_type, item.backup_id, userid, owner)); item.backup_type, item.backup_id, userid, owner));
errors = true; // do not stop here, instead continue errors = true; // do not stop here, instead continue
} else { } else if let Err(err) = pull_group(
if let Err(err) = pull_group(
worker, worker,
client, client,
src_repo, src_repo,
@ -542,11 +540,15 @@ pub async fn pull_store(
delete, delete,
Some((groups_done, group_count)), Some((groups_done, group_count)),
).await { ).await {
worker.log(format!("sync group {}/{} failed - {}", item.backup_type, item.backup_id, err)); worker.log(format!(
"sync group {}/{} failed - {}",
item.backup_type,
item.backup_id,
err,
));
errors = true; // do not stop here, instead continue errors = true; // do not stop here, instead continue
} }
} }
}
if delete { if delete {
let result: Result<(), Error> = proxmox::try_block!({ let result: Result<(), Error> = proxmox::try_block!({

View File

@ -43,8 +43,8 @@ pub async fn display_task_log(
} else { } else {
break; break;
} }
} else { } else if lines != limit {
if lines != limit { bail!("got wrong number of lines from server ({} != {})", lines, limit); } bail!("got wrong number of lines from server ({} != {})", lines, limit);
} }
} }

View File

@ -64,12 +64,10 @@ impl CachedUserInfo {
return false; return false;
} }
if let Some(expire) = info.expire { if let Some(expire) = info.expire {
if expire > 0 { if expire > 0 && expire <= now() {
if expire <= now() {
return false; return false;
} }
} }
}
return true; return true;
} else { } else {
return false; return false;

View File

@ -289,8 +289,12 @@ impl Interface {
if let Some(method6) = self.method6 { if let Some(method6) = self.method6 {
let mut skip_v6 = false; // avoid empty inet6 manual entry let mut skip_v6 = false; // avoid empty inet6 manual entry
if self.method.is_some() && method6 == NetworkConfigMethod::Manual { if self.method.is_some()
if self.comments6.is_none() && self.options6.is_empty() { skip_v6 = true; } && method6 == NetworkConfigMethod::Manual
&& self.comments6.is_none()
&& self.options6.is_empty()
{
skip_v6 = true;
} }
if !skip_v6 { if !skip_v6 {

View File

@ -10,7 +10,7 @@ use regex::Regex;
use proxmox::*; // for IP macros use proxmox::*; // for IP macros
pub static IPV4_REVERSE_MASK: &[&'static str] = &[ pub static IPV4_REVERSE_MASK: &[&str] = &[
"0.0.0.0", "0.0.0.0",
"128.0.0.0", "128.0.0.0",
"192.0.0.0", "192.0.0.0",