From 05b01cd7870f90c8db4f680b79ba2ec2730102be Mon Sep 17 00:00:00 2001 From: DeveloperC286 Date: Fri, 17 Sep 2021 20:48:34 +0100 Subject: [PATCH] refactor: VecDeques IntoIter fields to private --- library/alloc/src/collections/vec_deque/into_iter.rs | 8 +++++++- 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, + inner: VecDeque, +} + +impl IntoIter { + pub(super) fn new(inner: VecDeque) -> 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 IntoIterator for VecDeque { /// Consumes the `VecDeque` into a front-to-back iterator yielding elements by /// value. fn into_iter(self) -> IntoIter { - IntoIter { inner: self } + IntoIter::new(self) } }