From: DeveloperC286 Date: Fri, 17 Sep 2021 19:48:34 +0000 (+0100) Subject: refactor: VecDeques IntoIter fields to private X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=05b01cd7870f90c8db4f680b79ba2ec2730102be;p=rust.git refactor: VecDeques IntoIter fields to private --- 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) } }