tree wide: some stylistic clippy fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -338,8 +338,7 @@ pub fn dump_api_schema(
|
||||
child["path"] = sub_path.into();
|
||||
child["text"] = format!("{{{}}}", param_name).into();
|
||||
|
||||
let mut children = Vec::new();
|
||||
children.push(child);
|
||||
let children = vec![child];
|
||||
data["children"] = children.into();
|
||||
data["leaf"] = 0.into();
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ fn main() -> Result<(), Error> {
|
||||
proxmox_async::runtime::main(run())
|
||||
}
|
||||
|
||||
fn get_sync_job(id: &String) -> Result<SyncJobConfig, Error> {
|
||||
fn get_sync_job(id: &str) -> Result<SyncJobConfig, Error> {
|
||||
let (config, _digest) = sync::config()?;
|
||||
|
||||
config.lookup("sync", id)
|
||||
@ -536,12 +536,12 @@ pub fn complete_remote_datastore_group_filter(
|
||||
_arg: &str,
|
||||
param: &HashMap<String, String>,
|
||||
) -> Vec<String> {
|
||||
let mut list = Vec::new();
|
||||
|
||||
list.push("regex:".to_string());
|
||||
list.push("type:ct".to_string());
|
||||
list.push("type:host".to_string());
|
||||
list.push("type:vm".to_string());
|
||||
let mut list = vec![
|
||||
"regex:".to_string(),
|
||||
"type:ct".to_string(),
|
||||
"type:host".to_string(),
|
||||
"type:vm".to_string(),
|
||||
];
|
||||
|
||||
list.extend(
|
||||
complete_remote_datastore_group(_arg, param)
|
||||
|
@ -53,12 +53,12 @@ async fn get_backup_groups(store: &str) -> Result<Vec<GroupListItem>, Error> {
|
||||
|
||||
// shell completion helper
|
||||
pub fn complete_datastore_group_filter(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||
let mut list = Vec::new();
|
||||
|
||||
list.push("regex:".to_string());
|
||||
list.push("type:ct".to_string());
|
||||
list.push("type:host".to_string());
|
||||
list.push("type:vm".to_string());
|
||||
let mut list = vec![
|
||||
"regex:".to_string(),
|
||||
"type:ct".to_string(),
|
||||
"type:host".to_string(),
|
||||
"type:vm".to_string(),
|
||||
];
|
||||
|
||||
if let Some(store) = param.get("store") {
|
||||
let groups = proxmox_async::runtime::block_on(async { get_backup_groups(store).await });
|
||||
|
@ -453,7 +453,8 @@ async fn ls(
|
||||
.noheader(true)
|
||||
.sortby("name", false);
|
||||
|
||||
let res = get_api_children(path.unwrap_or(String::from("/")), rpcenv).await?;
|
||||
let path = path.unwrap_or_else(|| "".into());
|
||||
let res = get_api_children(path, rpcenv).await?;
|
||||
|
||||
format_and_print_result_full(
|
||||
&mut serde_json::to_value(res)?,
|
||||
|
@ -119,7 +119,7 @@ fn inspect_chunk(
|
||||
let chunk_path = Path::new(&chunk);
|
||||
|
||||
if digest.is_none() && use_filename_as_digest {
|
||||
digest = Some(if let Some((_, filename)) = chunk.rsplit_once("/") {
|
||||
digest = Some(if let Some((_, filename)) = chunk.rsplit_once('/') {
|
||||
String::from(filename)
|
||||
} else {
|
||||
chunk.clone()
|
||||
|
@ -205,7 +205,7 @@ async fn restore_key(
|
||||
bail!("cannot have both 'drive' and 'key(-file)' parameter set!");
|
||||
} else if key.is_some() && key_file.is_some() {
|
||||
bail!("cannot have both 'key' and 'key-file' parameter set!");
|
||||
} else if !drive_passed && !key.is_some() && !key_file.is_some() {
|
||||
} else if !drive_passed && key.is_none() && key_file.is_none() {
|
||||
bail!("one of either 'drive' or 'key' parameter must be set!");
|
||||
}
|
||||
if !tty::stdin_isatty() {
|
||||
|
Reference in New Issue
Block a user