getopt: whitespace cleanup
to make rustfmt happy Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
		| @ -56,8 +56,7 @@ pub fn parse_arguments<T: AsRef<str>>( | |||||||
|     args: &[T], |     args: &[T], | ||||||
|     arg_param: &Vec<&'static str>, |     arg_param: &Vec<&'static str>, | ||||||
|     schema: &ObjectSchema, |     schema: &ObjectSchema, | ||||||
| ) -> Result<(Value,Vec<String>), ParameterError> { | ) -> Result<(Value, Vec<String>), ParameterError> { | ||||||
|  |  | ||||||
|     let mut errors = ParameterError::new(); |     let mut errors = ParameterError::new(); | ||||||
|  |  | ||||||
|     let properties = &schema.properties; |     let properties = &schema.properties; | ||||||
| @ -91,8 +90,8 @@ pub fn parse_arguments<T: AsRef<str>>( | |||||||
|                     let mut next_is_bool = false; |                     let mut next_is_bool = false; | ||||||
|  |  | ||||||
|                     if (pos + 1) < args.len() { |                     if (pos + 1) < args.len() { | ||||||
|                         let next = args[pos+1].as_ref(); |                         let next = args[pos + 1].as_ref(); | ||||||
|                          if let RawArgument::Argument { value: _} = parse_argument(next) { |                         if let RawArgument::Argument { value: _ } = parse_argument(next) { | ||||||
|                             next_is_argument = true; |                             next_is_argument = true; | ||||||
|                             if let Ok(_) = parse_boolean(next) { next_is_bool = true; } |                             if let Ok(_) = parse_boolean(next) { next_is_bool = true; } | ||||||
|                         } |                         } | ||||||
| @ -103,7 +102,7 @@ pub fn parse_arguments<T: AsRef<str>>( | |||||||
|                             pos += 1; |                             pos += 1; | ||||||
|                             data.push((name, args[pos].as_ref().to_string())); |                             data.push((name, args[pos].as_ref().to_string())); | ||||||
|                         } else if can_default { |                         } else if can_default { | ||||||
|                            data.push((name, "true".to_string())); |                             data.push((name, "true".to_string())); | ||||||
|                         } else { |                         } else { | ||||||
|                             errors.push(format_err!("parameter '{}': {}", name, |                             errors.push(format_err!("parameter '{}': {}", name, | ||||||
|                                                     "missing boolean value.")); |                                                     "missing boolean value.")); | ||||||
| @ -153,13 +152,11 @@ pub fn parse_arguments<T: AsRef<str>>( | |||||||
|  |  | ||||||
|     let options = parse_parameter_strings(&data, schema, true)?; |     let options = parse_parameter_strings(&data, schema, true)?; | ||||||
|  |  | ||||||
|     Ok((options,rest)) |     Ok((options, rest)) | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| #[test] | #[test] | ||||||
| fn test_boolean_arg() { | fn test_boolean_arg() { | ||||||
|  |  | ||||||
|     let schema =  ObjectSchema::new("Parameters:") |     let schema =  ObjectSchema::new("Parameters:") | ||||||
|         .required( |         .required( | ||||||
|             "enable", BooleanSchema::new("Enable") |             "enable", BooleanSchema::new("Enable") | ||||||
| @ -191,7 +188,6 @@ fn test_boolean_arg() { | |||||||
|  |  | ||||||
| #[test] | #[test] | ||||||
| fn test_argument_paramenter() { | fn test_argument_paramenter() { | ||||||
|  |  | ||||||
|     let schema = ObjectSchema::new("Parameters:") |     let schema = ObjectSchema::new("Parameters:") | ||||||
|         .required("enable", BooleanSchema::new("Enable.")) |         .required("enable", BooleanSchema::new("Enable.")) | ||||||
|         .required("storage", StringSchema::new("Storage.")); |         .required("storage", StringSchema::new("Storage.")); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user