diff --git a/proxmox-router/src/cli/completion.rs b/proxmox-router/src/cli/completion.rs index 303ab406..0d9d45ca 100644 --- a/proxmox-router/src/cli/completion.rs +++ b/proxmox-router/src/cli/completion.rs @@ -87,12 +87,8 @@ fn get_simple_completion( if !arg_param.is_empty() { let prop_name = arg_param[0]; if let Some((optional, schema)) = cli_cmd.info.parameters.lookup(prop_name) { - let is_array_param = if let Schema::Array(_) = schema { - true - } else { - false - }; - + let is_array_param = matches!(schema, Schema::Array(_)); + if (optional || is_array_param) && args[0].starts_with('-') { // argument parameter is optional (or array) , and arg // looks like an option, so assume its empty and diff --git a/proxmox-router/src/cli/text_table.rs b/proxmox-router/src/cli/text_table.rs index fd5f079e..c8972233 100644 --- a/proxmox-router/src/cli/text_table.rs +++ b/proxmox-router/src/cli/text_table.rs @@ -391,11 +391,7 @@ fn format_table( Some(tup) => tup, None => bail!("property {} does not exist in schema.", sortkey), }; - let numeric_sort = match sort_prop_schema { - Schema::Integer(_) => true, - Schema::Number(_) => true, - _ => false, - }; + let numeric_sort = matches!(sort_prop_schema, Schema::Integer(_) | Schema::Number(_)); sortinfo.push((sortkey, sort_order, numeric_sort)); } @@ -454,12 +450,7 @@ fn format_table( None => bail!("property {} does not exist in schema.", name), }; - let is_numeric = match prop_schema { - Schema::Integer(_) => true, - Schema::Number(_) => true, - Schema::Boolean(_) => true, - _ => false, - }; + let is_numeric = matches!(prop_schema, Schema::Integer(_) | Schema::Number(_) | Schema::Boolean(_)); let (header, right_align, renderer) = options.lookup_column_info(name); @@ -658,12 +649,7 @@ fn format_object( None => bail!("property {} does not exist in schema.", name), }; - let is_numeric = match prop_schema { - Schema::Integer(_) => true, - Schema::Number(_) => true, - Schema::Boolean(_) => true, - _ => false, - }; + let is_numeric = matches!(prop_schema, Schema::Integer(_) | Schema::Number(_) | Schema::Boolean(_)); let (header, right_align, renderer) = options.lookup_column_info(name);