refactor: use map_err
This commit is contained in:
parent
f935c7bc72
commit
42fd182df7
@ -28,11 +28,7 @@ pub fn nameless_links(
|
||||
.enumerate()
|
||||
.map(|(nth, link)| {
|
||||
let hash = link.Hash.as_deref().unwrap_or_default();
|
||||
|
||||
match Cid::try_from(hash) {
|
||||
Ok(cid) => Ok(cid),
|
||||
Err(e) => Err(InvalidCidInLink::from((nth, link, e))),
|
||||
}
|
||||
Cid::try_from(hash).map_err(|e| InvalidCidInLink::from((nth, link, e)))
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user