lint: cargo fmt + cargo clippy

This commit is contained in:
rzmk 2025-12-19 08:13:12 -05:00
parent 809948b8f4
commit beb267d5b5
2 changed files with 43 additions and 37 deletions

View file

@ -1114,8 +1114,9 @@ impl CKAN {
let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new();
opsert("groups", groups, &mut map); opsert("groups", groups, &mut map);
opsert("owner_org", owner_org, &mut map); opsert("owner_org", owner_org, &mut map);
if let Some(custom) = custom_fields { if let Some(custom) = custom_fields
if custom.is_object() { && custom.is_object()
{
let custom_temp_map = custom.as_object().unwrap(); let custom_temp_map = custom.as_object().unwrap();
custom_map.extend( custom_map.extend(
custom_temp_map custom_temp_map
@ -1123,7 +1124,6 @@ impl CKAN {
.map(|item| (item.0.to_owned(), item.1.to_owned())), .map(|item| (item.0.to_owned(), item.1.to_owned())),
); );
} }
}
map.extend( map.extend(
custom_map custom_map
.iter() .iter()
@ -1660,8 +1660,9 @@ impl CKAN {
let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new();
opsert("groups", groups, &mut map); opsert("groups", groups, &mut map);
opsert("owner_org", owner_org, &mut map); opsert("owner_org", owner_org, &mut map);
if let Some(custom) = custom_fields { if let Some(custom) = custom_fields
if custom.is_object() { && custom.is_object()
{
let custom_temp_map = custom.as_object().unwrap(); let custom_temp_map = custom.as_object().unwrap();
custom_map.extend( custom_map.extend(
custom_temp_map custom_temp_map
@ -1669,7 +1670,6 @@ impl CKAN {
.map(|item| (item.0.to_owned(), item.1.to_owned())), .map(|item| (item.0.to_owned(), item.1.to_owned())),
); );
} }
}
map.extend( map.extend(
custom_map custom_map
.iter() .iter()
@ -1984,8 +1984,9 @@ impl CKAN {
let endpoint = self.url.clone() + "/api/3/action/config_option_update"; let endpoint = self.url.clone() + "/api/3/action/config_option_update";
let mut map: HashMap<&str, serde_json::Value> = HashMap::new(); let mut map: HashMap<&str, serde_json::Value> = HashMap::new();
let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new();
if let Some(options_obj) = options { if let Some(options_obj) = options
if options_obj.is_object() { && options_obj.is_object()
{
let custom_temp_map = options_obj.as_object().unwrap(); let custom_temp_map = options_obj.as_object().unwrap();
custom_map.extend( custom_map.extend(
custom_temp_map custom_temp_map
@ -1993,7 +1994,6 @@ impl CKAN {
.map(|item| (item.0.to_owned(), item.1.to_owned())), .map(|item| (item.0.to_owned(), item.1.to_owned())),
); );
} }
}
map.extend( map.extend(
custom_map custom_map
.iter() .iter()
@ -2060,8 +2060,9 @@ impl CKAN {
let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new(); let mut custom_map: HashMap<String, serde_json::Value> = HashMap::new();
opsert("groups", groups, &mut map); opsert("groups", groups, &mut map);
opsert("owner_org", owner_org, &mut map); opsert("owner_org", owner_org, &mut map);
if let Some(custom) = custom_fields { if let Some(custom) = custom_fields
if custom.is_object() { && custom.is_object()
{
let custom_temp_map = custom.as_object().unwrap(); let custom_temp_map = custom.as_object().unwrap();
custom_map.extend( custom_map.extend(
custom_temp_map custom_temp_map
@ -2069,7 +2070,6 @@ impl CKAN {
.map(|item| (item.0.to_owned(), item.1.to_owned())), .map(|item| (item.0.to_owned(), item.1.to_owned())),
); );
} }
}
map.extend( map.extend(
custom_map custom_map
.iter() .iter()

View file

@ -19,7 +19,13 @@ mod tests {
let ckan = get_ckan_builder().await; let ckan = get_ckan_builder().await;
let response = ckan.status_show().await?; let response = ckan.status_show().await?;
assert!(response.is_object()); 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); assert!(success);
Ok(()) Ok(())
} }