diff --git a/proxmox-schema/src/format.rs b/proxmox-schema/src/format.rs index 31fcef8a..11d6605d 100644 --- a/proxmox-schema/src/format.rs +++ b/proxmox-schema/src/format.rs @@ -142,7 +142,7 @@ pub fn dump_properties( skip: &[&str], ) -> String { let mut res = String::new(); - let next_indent = format!(" {}", indent); + let next_indent = format!(" {indent}"); let mut required_list: Vec = Vec::new(); let mut optional_list: Vec = Vec::new(); @@ -156,8 +156,8 @@ pub fn dump_properties( get_property_description(prop, schema, style, DocumentationFormat::ReST); if !indent.is_empty() { - param_descr = format!("{}{}", indent, param_descr); // indent first line - param_descr = param_descr.replace('\n', &format!("\n{}", indent)); // indent rest + param_descr = format!("{indent}{param_descr}"); // indent first line + param_descr = param_descr.replace('\n', &format!("\n{indent}")); // indent rest } if style == ParameterDisplayStyle::Config { @@ -339,15 +339,15 @@ pub fn get_schema_type_text(schema: &Schema, _style: ParameterDisplayStyle) -> S } Schema::Boolean(_) => String::from(""), Schema::Integer(integer_schema) => match (integer_schema.minimum, integer_schema.maximum) { - (Some(min), Some(max)) => format!(" ({} - {})", min, max), - (Some(min), None) => format!(" ({} - N)", min), - (None, Some(max)) => format!(" (-N - {})", max), + (Some(min), Some(max)) => format!(" ({min} - {max})"), + (Some(min), None) => format!(" ({min} - N)"), + (None, Some(max)) => format!(" (-N - {max})"), _ => String::from(""), }, Schema::Number(number_schema) => match (number_schema.minimum, number_schema.maximum) { - (Some(min), Some(max)) => format!(" ({} - {})", min, max), - (Some(min), None) => format!(" ({} - N)", min), - (None, Some(max)) => format!(" (-N - {})", max), + (Some(min), Some(max)) => format!(" ({min} - {max})"), + (Some(min), None) => format!(" ({min} - N)"), + (None, Some(max)) => format!(" (-N - {max})"), _ => String::from(""), }, Schema::Object(_) => String::from(""), @@ -362,7 +362,7 @@ pub fn get_property_string_type_text(schema: &Schema) -> String { Schema::Object(object_schema) => get_object_type_text(object_schema), Schema::Array(array_schema) => { let item_type = get_simple_type_text(array_schema.items, true); - format!("[{}, ...]", item_type) + format!("[{item_type}, ...]") } _ => panic!("get_property_string_type_text: expected array or object"), } @@ -374,12 +374,12 @@ fn get_object_type_text(object_schema: &ObjectSchema) -> String { let mut add_part = |name, optional, schema| { let tt = get_simple_type_text(schema, false); let text = if parts.is_empty() { - format!("{}={}", name, tt) + format!("{name}={tt}") } else { - format!(",{}={}", name, tt) + format!(",{name}={tt}") }; if optional { - parts.push(format!("[{}]", text)); + parts.push(format!("[{text}]")); } else { parts.push(text); } @@ -459,7 +459,7 @@ pub fn dump_api_return_schema(returns: &ReturnType, style: ParameterDisplayStyle }; let type_text = get_schema_type_text(schema, style); - let _ = write!(res, "**{}**\n\n", type_text); + let _ = write!(res, "**{type_text}**\n\n"); match schema { Schema::Null => { diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs index 836f77bd..1fc74e91 100644 --- a/proxmox-section-config/src/lib.rs +++ b/proxmox-section-config/src/lib.rs @@ -1263,11 +1263,7 @@ pub fn dump_section_config(config: &SectionConfig) -> String { use std::fmt::Write as _; let description = wrap_text("", "", properties.description(), 80); - let _ = write!( - res, - "\n**Section type** \'``{}``\': {}\n\n", - name, description - ); + let _ = write!(res, "\n**Section type** \'``{name}``\': {description}\n\n"); } res.push_str(&dump_properties(