clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-10-14 11:18:26 +02:00
parent e1dfcddc79
commit 54aec2fa8b
3 changed files with 8 additions and 12 deletions

View File

@ -6,7 +6,6 @@ use std::process::{Command, Stdio};
use std::io::Write;
use std::ffi::{CString, CStr};
use base64;
use anyhow::{bail, format_err, Error};
use serde_json::json;
@ -25,8 +24,7 @@ impl ProxmoxAuthenticator for PAM {
let mut auth = pam::Authenticator::with_password("proxmox-backup-auth").unwrap();
auth.get_handler().set_credentials(username.as_str(), password);
auth.authenticate()?;
return Ok(());
Ok(())
}
fn store_password(&self, username: &UsernameRef, password: &str) -> Result<(), Error> {
@ -99,7 +97,7 @@ pub fn encrypt_pw(password: &str) -> Result<String, Error> {
pub fn verify_crypt_pw(password: &str, enc_password: &str) -> Result<(), Error> {
let verify = crypt(password.as_bytes(), enc_password)?;
if &verify != enc_password {
if verify != enc_password {
bail!("invalid credentials");
}
Ok(())

View File

@ -251,8 +251,8 @@ async fn pull_snapshot(
Err(err) => {
match err.downcast_ref::<HttpError>() {
Some(HttpError { code, message }) => {
match code {
&StatusCode::NOT_FOUND => {
match *code {
StatusCode::NOT_FOUND => {
worker.log(format!("skipping snapshot {} - vanished since start of sync", snapshot));
return Ok(());
},
@ -434,7 +434,7 @@ pub async fn pull_group(
let snapshot = BackupDir::new(item.backup_type, item.backup_id, item.backup_time)?;
// in-progress backups can't be synced
if let None = item.size {
if item.size.is_none() {
worker.log(format!("skipping snapshot {} - in-progress backup", snapshot));
continue;
}
@ -520,9 +520,8 @@ pub async fn pull_store(
}
let group_count = list.len();
let mut groups_done = 0;
for item in list {
for (groups_done, item) in list.into_iter().enumerate() {
let group = BackupGroup::new(&item.backup_type, &item.backup_id);
let (owner, _lock_guard) = tgt_store.create_locked_backup_group(&group, &userid)?;
@ -547,7 +546,6 @@ pub async fn pull_store(
errors = true; // do not stop here, instead continue
}
}
groups_done += 1;
}
if delete {

View File

@ -272,7 +272,7 @@ impl RRD {
t += reso; index = (index + 1) % RRD_DATA_ENTRIES;
}
(start, reso, list.into())
(start, reso, list)
}
pub fn from_raw(mut raw: &[u8]) -> Result<Self, std::io::Error> {
@ -289,7 +289,7 @@ impl RRD {
}
if rrd.magic != PROXMOX_RRD_MAGIC_1_0 {
let msg = format!("wrong magic number");
let msg = "wrong magic number".to_string();
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
}