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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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
This commit is contained in:
Joel Natividad 2025-05-27 10:49:09 -04:00
parent b1d8d957f9
commit 661638a406

View file

@ -1351,8 +1351,8 @@ impl CKAN {
let mut custom_map: HashMap<String, serde_json::Value> = 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<String, serde_json::Value> = 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<String, serde_json::Value> = 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<String, serde_json::Value> = 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()