Remove if-else by map()

This commit is contained in:
Matthias Beyer 2016-06-11 06:53:06 +02:00
parent 29be4029da
commit 8c7ca95af1

View file

@ -45,15 +45,7 @@ impl<'a> Link<'a> {
/// For interal use only. Load an Link from a store id, if this is actually a Link /// For interal use only. Load an Link from a store id, if this is actually a Link
fn retrieve(store: &'a Store, id: StoreId) -> Result<Option<Link<'a>>> { fn retrieve(store: &'a Store, id: StoreId) -> Result<Option<Link<'a>>> {
store.retrieve(id) store.retrieve(id)
.map(|fle| { .map(|fle| Link::get_link_uri_from_filelockentry(&fle).map(|_| Link { link: fle }))
if let Some(_) = Link::get_link_uri_from_filelockentry(&fle) {
Some(Link {
link: fle
})
} else {
None
}
})
.map_err(|e| LE::new(LEK::StoreReadError, Some(Box::new(e)))) .map_err(|e| LE::new(LEK::StoreReadError, Some(Box::new(e))))
} }