clippy: more misc fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
367c0ff7c6
commit
4d104cd4d8
@ -63,11 +63,8 @@ fn main() {
|
||||
let mut rpcenv = CliEnvironment::new();
|
||||
rpcenv.set_auth_id(Some(String::from("root@pam")));
|
||||
|
||||
match proxmox_backup::tools::runtime::main(do_update(&mut rpcenv)) {
|
||||
Err(err) => {
|
||||
eprintln!("error during update: {}", err);
|
||||
std::process::exit(1);
|
||||
},
|
||||
_ => (),
|
||||
if let Err(err) = proxmox_backup::tools::runtime::main(do_update(&mut rpcenv)) {
|
||||
eprintln!("error during update: {}", err);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -315,22 +315,13 @@ fn change_passphrase(
|
||||
},
|
||||
)]
|
||||
/// Print the encryption key's metadata.
|
||||
fn show_key(
|
||||
path: Option<String>,
|
||||
param: Value,
|
||||
) -> Result<(), Error> {
|
||||
fn show_key(path: Option<String>, param: Value) -> Result<(), Error> {
|
||||
let path = match path {
|
||||
Some(path) => PathBuf::from(path),
|
||||
None => {
|
||||
let path = find_default_encryption_key()?
|
||||
.ok_or_else(|| {
|
||||
format_err!("no encryption file provided and no default file found")
|
||||
})?;
|
||||
path
|
||||
}
|
||||
None => find_default_encryption_key()?
|
||||
.ok_or_else(|| format_err!("no encryption file provided and no default file found"))?,
|
||||
};
|
||||
|
||||
|
||||
let config: KeyConfig = serde_json::from_slice(&file_get_contents(path.clone())?)?;
|
||||
|
||||
let output_format = get_output_format(¶m);
|
||||
@ -442,13 +433,8 @@ fn paper_key(
|
||||
) -> Result<(), Error> {
|
||||
let path = match path {
|
||||
Some(path) => PathBuf::from(path),
|
||||
None => {
|
||||
let path = find_default_encryption_key()?
|
||||
.ok_or_else(|| {
|
||||
format_err!("no encryption file provided and no default file found")
|
||||
})?;
|
||||
path
|
||||
}
|
||||
None => find_default_encryption_key()?
|
||||
.ok_or_else(|| format_err!("no encryption file provided and no default file found"))?,
|
||||
};
|
||||
|
||||
let data = file_get_contents(&path)?;
|
||||
|
@ -345,7 +345,7 @@ fn unmap(
|
||||
let mut any = false;
|
||||
for (backing, loopdev) in tools::fuse_loop::find_all_mappings()? {
|
||||
let name = tools::systemd::unescape_unit(&backing)?;
|
||||
println!("{}:\t{}", loopdev.unwrap_or("(unmapped)".to_owned()), name);
|
||||
println!("{}:\t{}", loopdev.unwrap_or_else(|| "(unmapped)".to_string()), name);
|
||||
any = true;
|
||||
}
|
||||
if !any {
|
||||
|
@ -133,7 +133,7 @@ fn list_permissions(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Val
|
||||
let output_format = get_output_format(¶m);
|
||||
|
||||
let info = &api2::access::API_METHOD_LIST_PERMISSIONS;
|
||||
let mut data = match info.handler {
|
||||
let data = match info.handler {
|
||||
ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
@ -161,7 +161,7 @@ fn list_permissions(param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<Val
|
||||
}
|
||||
}
|
||||
} else {
|
||||
format_and_print_result(&mut data, &output_format);
|
||||
format_and_print_result(&data, &output_format);
|
||||
}
|
||||
|
||||
Ok(Value::Null)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#[allow(clippy::module_inception)]
|
||||
mod rrd;
|
||||
pub use rrd::*;
|
||||
mod cache;
|
||||
|
Loading…
Reference in New Issue
Block a user