1
Fork 0

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

@ -9,10 +9,11 @@
// ignore-tidy-filelength
use core::array;
use core::cmp::{self, Ordering};
use core::fmt;
use core::hash::{Hash, Hasher};
use core::iter::{once, repeat_with, FromIterator, FusedIterator};
use core::iter::{repeat_with, FromIterator, FusedIterator};
use core::mem::{self, replace, ManuallyDrop};
use core::ops::{Index, IndexMut, Range, RangeBounds, Try};
use core::ptr::{self, NonNull};
@ -99,7 +100,7 @@ impl<'a, 'b, T> PairSlices<'a, 'b, T> {
}
fn remainder(self) -> impl Iterator<Item = &'b [T]> {
once(self.b0).chain(once(self.b1))
array::IntoIter::new([self.b0, self.b1])
}
}

View file

@ -77,6 +77,7 @@
#![cfg_attr(test, feature(new_uninit))]
#![feature(allocator_api)]
#![feature(array_chunks)]
#![feature(array_value_iter)]
#![feature(array_windows)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]