diff --git a/src/lib.rs b/src/lib.rs index e021be2..bd80b22 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1114,15 +1114,15 @@ impl CKAN { let mut custom_map: HashMap = HashMap::new(); opsert("groups", groups, &mut map); opsert("owner_org", owner_org, &mut map); - if let Some(custom) = custom_fields { - if custom.is_object() { - let custom_temp_map = custom.as_object().unwrap(); - custom_map.extend( - custom_temp_map - .iter() - .map(|item| (item.0.to_owned(), item.1.to_owned())), - ); - } + if let Some(custom) = custom_fields + && custom.is_object() + { + let custom_temp_map = custom.as_object().unwrap(); + custom_map.extend( + custom_temp_map + .iter() + .map(|item| (item.0.to_owned(), item.1.to_owned())), + ); } map.extend( custom_map @@ -1660,15 +1660,15 @@ impl CKAN { let mut custom_map: HashMap = HashMap::new(); opsert("groups", groups, &mut map); opsert("owner_org", owner_org, &mut map); - if let Some(custom) = custom_fields { - if custom.is_object() { - let custom_temp_map = custom.as_object().unwrap(); - custom_map.extend( - custom_temp_map - .iter() - .map(|item| (item.0.to_owned(), item.1.to_owned())), - ); - } + if let Some(custom) = custom_fields + && custom.is_object() + { + let custom_temp_map = custom.as_object().unwrap(); + custom_map.extend( + custom_temp_map + .iter() + .map(|item| (item.0.to_owned(), item.1.to_owned())), + ); } map.extend( custom_map @@ -1984,15 +1984,15 @@ impl CKAN { let endpoint = self.url.clone() + "/api/3/action/config_option_update"; let mut map: HashMap<&str, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap = HashMap::new(); - if let Some(options_obj) = options { - if options_obj.is_object() { - let custom_temp_map = options_obj.as_object().unwrap(); - custom_map.extend( - custom_temp_map - .iter() - .map(|item| (item.0.to_owned(), item.1.to_owned())), - ); - } + if let Some(options_obj) = options + && options_obj.is_object() + { + let custom_temp_map = options_obj.as_object().unwrap(); + custom_map.extend( + custom_temp_map + .iter() + .map(|item| (item.0.to_owned(), item.1.to_owned())), + ); } map.extend( custom_map @@ -2060,15 +2060,15 @@ impl CKAN { let mut custom_map: HashMap = HashMap::new(); opsert("groups", groups, &mut map); opsert("owner_org", owner_org, &mut map); - if let Some(custom) = custom_fields { - if custom.is_object() { - let custom_temp_map = custom.as_object().unwrap(); - custom_map.extend( - custom_temp_map - .iter() - .map(|item| (item.0.to_owned(), item.1.to_owned())), - ); - } + if let Some(custom) = custom_fields + && custom.is_object() + { + let custom_temp_map = custom.as_object().unwrap(); + custom_map.extend( + custom_temp_map + .iter() + .map(|item| (item.0.to_owned(), item.1.to_owned())), + ); } map.extend( custom_map diff --git a/tests/general.rs b/tests/general.rs index 30feeae..bb4ee2d 100644 --- a/tests/general.rs +++ b/tests/general.rs @@ -19,7 +19,13 @@ mod tests { let ckan = get_ckan_builder().await; let response = ckan.status_show().await?; assert!(response.is_object()); - let success = response.as_object().unwrap().get("success").unwrap().as_bool().unwrap(); + let success = response + .as_object() + .unwrap() + .get("success") + .unwrap() + .as_bool() + .unwrap(); assert!(success); Ok(()) }