Use Result::map() instead of matching Err to itself
authorMegaBrutal <megabrutal+github@megabrutal.com>
Sat, 18 Feb 2023 22:00:00 +0000 (23:00 +0100)
committerMegaBrutal <megabrutal+github@megabrutal.com>
Sat, 18 Feb 2023 22:00:00 +0000 (23:00 +0100)
src/main.rs

index 90d51c37b78752d8f4625bb2fc44fe45118c0000..f17f6ffb92204d7597fd868e9058a14fbdb381aa 100644 (file)
@@ -78,10 +78,7 @@ fn main() {
             },
             Err(e) => Err(HLQueryError::IOError(e))
         })
-        .map(|addresses| match addresses {
-            Ok(iter_addr) => Ok(iter_addr.map(|addr| HLQueryResult::new(&client, addr)).collect()),
-            Err(e) => Err(e)
-        })
+        .map(|address_group| address_group.map(|addresses| addresses.map(|addr| HLQueryResult::new(&client, addr)).collect()))
         .collect();
 
     println!("{}\n", serde_json::to_string_pretty(&query_results).unwrap());