diff options
author | Bogdan Arabadzhi <bogdan.today@gmail.com> | 2019-10-12 14:14:23 +0200 |
---|---|---|
committer | Bogdan Arabadzhi <bogdan.today@gmail.com> | 2019-10-12 14:14:23 +0200 |
commit | 2db1cec12d635208839d6873d54722e6f4ec26cd (patch) | |
tree | d30b4585aef3887aebea4ff685af81c3bae8812d /ipfs-api | |
parent | 5ab95adf6b93d61077b23bd116db14151ae799ca (diff) |
Use if let for file error checking
Diffstat (limited to 'ipfs-api')
-rw-r--r-- | ipfs-api/src/client.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ipfs-api/src/client.rs b/ipfs-api/src/client.rs index afcd4c9..668c3fd 100644 --- a/ipfs-api/src/client.rs +++ b/ipfs-api/src/client.rs @@ -535,8 +535,8 @@ impl IpfsClient { for (path, file_size) in paths_to_add { let file = std::fs::File::open(&path); - if file.is_err() { - return Box::new(future::err(file.unwrap_err().into())); + if let Err(err) = file { + return Box::new(future::err(err.into())); } let file_name = match prefix { Some(prefix) => path.strip_prefix(prefix).unwrap(), |