aboutsummaryrefslogtreecommitdiff
path: root/crates/test_utils
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-16 21:28:23 +0100
committerGitHub <[email protected]>2021-06-16 21:28:23 +0100
commit7b4f5c0262bbdf7e9db81734eb9c82dd04eb82cb (patch)
treec96519e0107b3f844ba4e7d3dc988ef6c3735886 /crates/test_utils
parentd6b8af44829521a9f925c4d87599efa3fef38edc (diff)
parent35772256f8ff3c52e469fc2bd388ad80ff8d79c7 (diff)
Merge #9304
9304: internal: cleanup tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/test_utils')
-rw-r--r--crates/test_utils/src/minicore.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs
index e04ca58d2..2f0da7fe5 100644
--- a/crates/test_utils/src/minicore.rs
+++ b/crates/test_utils/src/minicore.rs
@@ -20,6 +20,7 @@
20//! future: pin 20//! future: pin
21//! option: 21//! option:
22//! result: 22//! result:
23//! iterator: option
23 24
24pub mod marker { 25pub mod marker {
25 // region:sized 26 // region:sized
@@ -206,9 +207,70 @@ pub mod task {
206} 207}
207// endregion:future 208// endregion:future
208 209
210// region:iterator
211pub mod iter {
212 mod adapters {
213 pub struct Take<I> {
214 iter: I,
215 n: usize,
216 }
217
218 impl<I> Iterator for Take<I>
219 where
220 I: Iterator,
221 {
222 type Item = <I as Iterator>::Item;
223
224 fn next(&mut self) -> Option<<I as Iterator>::Item> {
225 loop {}
226 }
227 }
228 }
229 pub use self::adapters::Take;
230
231 mod traits {
232 mod iterator {
233 use super::super::Take;
234
235 pub trait Iterator {
236 type Item;
237 #[lang = "next"]
238 fn next(&mut self) -> Option<Self::Item>;
239 fn nth(&mut self, n: usize) -> Option<Self::Item> {
240 loop {}
241 }
242 fn take(self, n: usize) -> crate::iter::Take<Self> {
243 loop {}
244 }
245 }
246 }
247 pub use self::iterator::Iterator;
248
249 mod collect {
250 pub trait IntoIterator {
251 type Item;
252 type IntoIter: Iterator<Item = Self::Item>;
253 #[lang = "into_iter"]
254 fn into_iter(self) -> Self::IntoIter;
255 }
256 impl<I: Iterator> IntoIterator for I {
257 type Item = I::Item;
258 type IntoIter = I;
259 fn into_iter(self) -> I {
260 self
261 }
262 }
263 }
264 pub use self::collect::IntoIterator;
265 }
266 pub use self::traits::{IntoIterator, Iterator};
267}
268// endregion:iterator
269
209pub mod prelude { 270pub mod prelude {
210 pub mod v1 { 271 pub mod v1 {
211 pub use crate::{ 272 pub use crate::{
273 iter::{IntoIterator, Iterator}, // :iterator
212 marker::Sized, // :sized 274 marker::Sized, // :sized
213 ops::{Fn, FnMut, FnOnce}, // :fn 275 ops::{Fn, FnMut, FnOnce}, // :fn
214 option::Option::{self, None, Some}, // :option 276 option::Option::{self, None, Some}, // :option