Skip to content

Commit a32be12

Browse files
committed
Replace some once(x).chain(once(y)) with [x, y] IntoIter
Now that we have by-value array iterators...
1 parent 99afbfc commit a32be12

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

alloc/src/collections/vec_deque.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
// ignore-tidy-filelength
1111

12+
use core::array;
1213
use core::cmp::{self, Ordering};
1314
use core::fmt;
1415
use core::hash::{Hash, Hasher};
15-
use core::iter::{once, repeat_with, FromIterator, FusedIterator};
16+
use core::iter::{repeat_with, FromIterator, FusedIterator};
1617
use core::mem::{self, replace, ManuallyDrop};
1718
use core::ops::{Index, IndexMut, Range, RangeBounds, Try};
1819
use core::ptr::{self, NonNull};
@@ -99,7 +100,7 @@ impl<'a, 'b, T> PairSlices<'a, 'b, T> {
99100
}
100101

101102
fn remainder(self) -> impl Iterator<Item = &'b [T]> {
102-
once(self.b0).chain(once(self.b1))
103+
array::IntoIter::new([self.b0, self.b1])
103104
}
104105
}
105106

alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#![cfg_attr(test, feature(new_uninit))]
7878
#![feature(allocator_api)]
7979
#![feature(array_chunks)]
80+
#![feature(array_value_iter)]
8081
#![feature(array_windows)]
8182
#![feature(allow_internal_unstable)]
8283
#![feature(arbitrary_self_types)]

0 commit comments

Comments
 (0)