From 661638a406beaf429d2b282d68ee05eebb06deda Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Tue, 27 May 2025 10:49:09 -0400 Subject: [PATCH] refactor: change unstable let chains to nested if cargo t Compiling ckanaction v0.1.0 (/Users/joelnatividad/GitHub/ckanaction) error[E0658]: `let` expressions in this position are unstable --> src/lib.rs:1354:12 | 1354 | if let Some(custom) = custom_fields | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #53667 for more information error[E0658]: `let` expressions in this position are unstable --> src/lib.rs:1983:12 | 1983 | if let Some(custom) = custom_fields | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #53667 for more information error[E0658]: `let` expressions in this position are unstable --> src/lib.rs:2370:12 | 2370 | if let Some(options_obj) = options | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #53667 for more information error[E0658]: `let` expressions in this position are unstable --> src/lib.rs:2449:12 | 2449 | if let Some(custom) = custom_fields | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #53667 for more information For more information about this error, try `rustc --explain E0658`. error: could not compile `ckanaction` (lib test) due to 4 previous errors warning: build failed, waiting for other jobs to finish... error: could not compile `ckanaction` (lib) due to 4 previous errors --- src/lib.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d168708..043a66d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1351,8 +1351,8 @@ 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 - && custom.is_object() { + if let Some(custom) = custom_fields { + if custom.is_object() { let custom_temp_map = custom.as_object().unwrap(); custom_map.extend( custom_temp_map @@ -1360,6 +1360,7 @@ impl CKAN { .map(|item| (item.0.to_owned(), item.1.to_owned())), ); } + } map.extend( custom_map .iter() @@ -1980,8 +1981,8 @@ 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 - && custom.is_object() { + if let Some(custom) = custom_fields { + if custom.is_object() { let custom_temp_map = custom.as_object().unwrap(); custom_map.extend( custom_temp_map @@ -1989,6 +1990,7 @@ impl CKAN { .map(|item| (item.0.to_owned(), item.1.to_owned())), ); } + } map.extend( custom_map .iter() @@ -2367,8 +2369,8 @@ 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 - && options_obj.is_object() { + 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 @@ -2376,6 +2378,7 @@ impl CKAN { .map(|item| (item.0.to_owned(), item.1.to_owned())), ); } + } map.extend( custom_map .iter() @@ -2446,8 +2449,8 @@ 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 - && custom.is_object() { + if let Some(custom) = custom_fields { + if custom.is_object() { let custom_temp_map = custom.as_object().unwrap(); custom_map.extend( custom_temp_map @@ -2455,6 +2458,7 @@ impl CKAN { .map(|item| (item.0.to_owned(), item.1.to_owned())), ); } + } map.extend( custom_map .iter()