Remove iflet by mapping over Option/Result types

This commit is contained in:
Matthias Beyer 2016-05-14 19:10:25 +02:00
parent f9f5fa5717
commit 7b612ce8fb

View file

@ -352,15 +352,14 @@ impl Store {
let mut path = self.path().clone();
path.push(mod_name);
if let Some(path) = path.to_str() {
let path = [ path, "/*" ].join("");
debug!("glob()ing with '{}'", path);
glob(&path[..])
.map(|paths| StoreIdIterator::new(Box::new(GlobStoreIdIterator::new(paths))))
.map_err(|e| SE::new(SEK::GlobError, Some(Box::new(e))))
} else {
Err(SE::new(SEK::EncodingError, None))
}
path.to_str()
.ok_or(SE::new(SEK::EncodingError, None))
.and_then(|path| {
let path = [ path, "/*" ].join("");
debug!("glob()ing with '{}'", path);
glob(&path[..]).map_err(|e| SE::new(SEK::GlobError, Some(Box::new(e))))
})
.map(|paths| StoreIdIterator::new(Box::new(GlobStoreIdIterator::new(paths))))
}
// Walk the store tree for the module