diff options
author | Aleksey Kladov <[email protected]> | 2021-06-17 09:28:44 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-17 09:28:44 +0100 |
commit | c42cdff3d2ed2e30add09dd0d602181b6f83534d (patch) | |
tree | b927b06a3f866f6ebac907d7714fa05af7422d4e /crates/test_utils | |
parent | 9b3aa591cd0672e9b7bdf3e5aab630cd09a4d546 (diff) |
internal: minimize minicore
We want to keep minicore small, so let's split out iterator adapters and
sources into a separate `iterators` region, and use them only when
needed.
Diffstat (limited to 'crates/test_utils')
-rw-r--r-- | crates/test_utils/src/minicore.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 1a0573d7a..e6d2301c7 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -21,6 +21,7 @@ | |||
21 | //! option: | 21 | //! option: |
22 | //! result: | 22 | //! result: |
23 | //! iterator: option | 23 | //! iterator: option |
24 | //! iterators: iterator | ||
24 | 25 | ||
25 | pub mod marker { | 26 | pub mod marker { |
26 | // region:sized | 27 | // region:sized |
@@ -209,6 +210,7 @@ pub mod task { | |||
209 | 210 | ||
210 | // region:iterator | 211 | // region:iterator |
211 | pub mod iter { | 212 | pub mod iter { |
213 | // region:iterators | ||
212 | mod adapters { | 214 | mod adapters { |
213 | pub struct Take<I> { | 215 | pub struct Take<I> { |
214 | iter: I, | 216 | iter: I, |
@@ -249,6 +251,7 @@ pub mod iter { | |||
249 | pub use self::repeat::{repeat, Repeat}; | 251 | pub use self::repeat::{repeat, Repeat}; |
250 | } | 252 | } |
251 | pub use self::sources::{repeat, Repeat}; | 253 | pub use self::sources::{repeat, Repeat}; |
254 | // endregion:iterators | ||
252 | 255 | ||
253 | mod traits { | 256 | mod traits { |
254 | mod iterator { | 257 | mod iterator { |
@@ -261,15 +264,17 @@ pub mod iter { | |||
261 | fn nth(&mut self, n: usize) -> Option<Self::Item> { | 264 | fn nth(&mut self, n: usize) -> Option<Self::Item> { |
262 | loop {} | 265 | loop {} |
263 | } | 266 | } |
264 | fn take(self, n: usize) -> crate::iter::Take<Self> { | ||
265 | loop {} | ||
266 | } | ||
267 | fn by_ref(&mut self) -> &mut Self | 267 | fn by_ref(&mut self) -> &mut Self |
268 | where | 268 | where |
269 | Self: Sized, | 269 | Self: Sized, |
270 | { | 270 | { |
271 | self | 271 | self |
272 | } | 272 | } |
273 | // region:iterators | ||
274 | fn take(self, n: usize) -> crate::iter::Take<Self> { | ||
275 | loop {} | ||
276 | } | ||
277 | // endregion:iterators | ||
273 | } | 278 | } |
274 | impl<I: Iterator + ?Sized> Iterator for &mut I { | 279 | impl<I: Iterator + ?Sized> Iterator for &mut I { |
275 | type Item = I::Item; | 280 | type Item = I::Item; |