Refactor to use Iterator::fold()
This commit is contained in:
parent
30ef3bf0d3
commit
7ecaad830c
1 changed files with 22 additions and 23 deletions
|
@ -634,12 +634,11 @@ pub mod store_check {
|
|||
//
|
||||
// The lambda returns an error if something fails
|
||||
let aggregate_link_network = |store: &Store| -> Result<HashMap<StoreId, Linking>> {
|
||||
let iter = store
|
||||
store
|
||||
.entries()?
|
||||
.into_get_iter(store);
|
||||
|
||||
let mut map = HashMap::new();
|
||||
for element in iter {
|
||||
.into_get_iter(store)
|
||||
.fold(Ok(HashMap::new()), |map, element| {
|
||||
map.and_then(|mut map| {
|
||||
debug!("Checking element = {:?}", element);
|
||||
let entry = element?.ok_or_else(|| {
|
||||
LE::from(String::from("TODO: Not yet handled"))
|
||||
|
@ -660,9 +659,9 @@ pub mod store_check {
|
|||
}
|
||||
|
||||
map.insert(entry.get_location().clone(), linking);
|
||||
}
|
||||
|
||||
Ok(map)
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
// Helper to check whethre all StoreIds in the network actually exists
|
||||
|
|
Loading…
Reference in a new issue