diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-09-19 17:31:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-19 17:31:34 +0900 |
| commit | e4dbe272351627380a9cdad78164d5e672c773fb (patch) | |
| tree | 57fee9d78cd5a5bfec0eb7623e68fab72219dbbf | |
| parent | 43660591243445183040adfeee814f7ebaf656ec (diff) | |
| parent | 05b01cd7870f90c8db4f680b79ba2ec2730102be (diff) | |
Rollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r=Mark-Simulacrum
refactor: VecDeques IntoIter fields to private Made the fields of VecDeque's IntoIter private by creating a IntoIter::from(...) function to create a new instance of IntoIter and migrating usage to use IntoIter::from(...).
| -rw-r--r-- | library/alloc/src/collections/vec_deque/into_iter.rs | 8 | ||||
| -rw-r--r-- | library/alloc/src/collections/vec_deque/mod.rs | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/library/alloc/src/collections/vec_deque/into_iter.rs b/library/alloc/src/collections/vec_deque/into_iter.rs index 5f13c3bf303..54a157be0b9 100644 --- a/library/alloc/src/collections/vec_deque/into_iter.rs +++ b/library/alloc/src/collections/vec_deque/into_iter.rs @@ -17,7 +17,13 @@ pub struct IntoIter< T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global, > { - pub(crate) inner: VecDeque<T, A>, + inner: VecDeque<T, A>, +} + +impl<T, A: Allocator> IntoIter<T, A> { + pub(super) fn new(inner: VecDeque<T, A>) -> Self { + IntoIter { inner } + } } #[stable(feature = "collection_debug", since = "1.17.0")] diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index e4b28204158..10144cc17bf 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -2827,7 +2827,7 @@ impl<T, A: Allocator> IntoIterator for VecDeque<T, A> { /// Consumes the `VecDeque` into a front-to-back iterator yielding elements by /// value. fn into_iter(self) -> IntoIter<T, A> { - IntoIter { inner: self } + IntoIter::new(self) } } |
