refactor: use unwrap_or_else
@@ -55,13 +55,10 @@ fn main() {
eprintln!();
- let stream = match ipfs.cat_unixfs(cid, None).await {
- Ok(stream) => stream,
- Err(e) => {
+ let stream = ipfs.cat_unixfs(cid, None).await.unwrap_or_else(|e| {
eprintln!("Error: {}", e);
exit(1);
- }
- };
+ });
// The stream needs to be pinned on the stack to be used with StreamExt::next
pin_mut!(stream);
let mut stdout = async_std::io::stdout();
