mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-01 15:12:23 +00:00
clippy: use matches!
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
a81b2672d8
commit
b1c2250000
@ -87,12 +87,8 @@ fn get_simple_completion(
|
|||||||
if !arg_param.is_empty() {
|
if !arg_param.is_empty() {
|
||||||
let prop_name = arg_param[0];
|
let prop_name = arg_param[0];
|
||||||
if let Some((optional, schema)) = cli_cmd.info.parameters.lookup(prop_name) {
|
if let Some((optional, schema)) = cli_cmd.info.parameters.lookup(prop_name) {
|
||||||
let is_array_param = if let Schema::Array(_) = schema {
|
let is_array_param = matches!(schema, Schema::Array(_));
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
if (optional || is_array_param) && args[0].starts_with('-') {
|
if (optional || is_array_param) && args[0].starts_with('-') {
|
||||||
// argument parameter is optional (or array) , and arg
|
// argument parameter is optional (or array) , and arg
|
||||||
// looks like an option, so assume its empty and
|
// looks like an option, so assume its empty and
|
||||||
|
@ -391,11 +391,7 @@ fn format_table<W: Write>(
|
|||||||
Some(tup) => tup,
|
Some(tup) => tup,
|
||||||
None => bail!("property {} does not exist in schema.", sortkey),
|
None => bail!("property {} does not exist in schema.", sortkey),
|
||||||
};
|
};
|
||||||
let numeric_sort = match sort_prop_schema {
|
let numeric_sort = matches!(sort_prop_schema, Schema::Integer(_) | Schema::Number(_));
|
||||||
Schema::Integer(_) => true,
|
|
||||||
Schema::Number(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
sortinfo.push((sortkey, sort_order, numeric_sort));
|
sortinfo.push((sortkey, sort_order, numeric_sort));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,12 +450,7 @@ fn format_table<W: Write>(
|
|||||||
None => bail!("property {} does not exist in schema.", name),
|
None => bail!("property {} does not exist in schema.", name),
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_numeric = match prop_schema {
|
let is_numeric = matches!(prop_schema, Schema::Integer(_) | Schema::Number(_) | Schema::Boolean(_));
|
||||||
Schema::Integer(_) => true,
|
|
||||||
Schema::Number(_) => true,
|
|
||||||
Schema::Boolean(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let (header, right_align, renderer) = options.lookup_column_info(name);
|
let (header, right_align, renderer) = options.lookup_column_info(name);
|
||||||
|
|
||||||
@ -658,12 +649,7 @@ fn format_object<W: Write>(
|
|||||||
None => bail!("property {} does not exist in schema.", name),
|
None => bail!("property {} does not exist in schema.", name),
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_numeric = match prop_schema {
|
let is_numeric = matches!(prop_schema, Schema::Integer(_) | Schema::Number(_) | Schema::Boolean(_));
|
||||||
Schema::Integer(_) => true,
|
|
||||||
Schema::Number(_) => true,
|
|
||||||
Schema::Boolean(_) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let (header, right_align, renderer) = options.lookup_column_info(name);
|
let (header, right_align, renderer) = options.lookup_column_info(name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user