ir: Cleanup get_items.

This commit is contained in:
Emilio Cobos Álvarez
2018-10-30 22:28:36 +01:00
committed by Ryan Hunt
parent ae964aad6c
commit e49cabfd43
+4 -5
View File
@@ -140,11 +140,10 @@ impl<T: Item + Clone> ItemMap<T> {
}
pub fn get_items(&self, path: &Path) -> Option<Vec<ItemContainer>> {
match self.data.get(path) {
Some(&ItemValue::Cfg(ref items)) => Some(items.iter().map(|x| x.container()).collect()),
Some(&ItemValue::Single(ref item)) => Some(vec![item.container()]),
None => None,
}
Some(match *self.data.get(path)? {
ItemValue::Cfg(ref items) => items.iter().map(|x| x.container()).collect(),
ItemValue::Single(ref item) => vec![item.container()],
})
}
pub fn filter<F>(&mut self, callback: F)