Replace some once(x).chain(once(y)) with [x, y] IntoIter

Now that we have by-value array iterators...
This commit is contained in:
Scott McMurray 2020-10-03 16:51:43 -07:00
parent 738d4a7a36
commit d74b8e0505
7 changed files with 11 additions and 9 deletions

View file

@ -341,9 +341,7 @@ impl<T> PerNS<Option<T>> {
/// Returns an iterator over the items which are `Some`.
pub fn present_items(self) -> impl Iterator<Item = T> {
use std::iter::once;
once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it)
IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
}
}