diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-18 21:49:31 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-18 21:49:31 +0100 |
commit | 664912fbf83718508156fc09d2a0ff2448de175a (patch) | |
tree | 8cac1ee23ff3232ccc30eb174da908cecf34df8f /crates/test_utils/src | |
parent | 71490ed84b7fbfabecdf44b25d48ff8aafc4c601 (diff) | |
parent | 90da9fc9b302de46097065f0d6428ad33c292217 (diff) |
Merge #9332
9332: minor: use minicore r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/minicore.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 71f07d38a..ce6ad8541 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -22,7 +22,7 @@ | |||
22 | //! option: | 22 | //! option: |
23 | //! result: | 23 | //! result: |
24 | //! iterator: option | 24 | //! iterator: option |
25 | //! iterators: iterator | 25 | //! iterators: iterator, fn |
26 | //! default: sized | 26 | //! default: sized |
27 | //! clone: sized | 27 | //! clone: sized |
28 | //! copy: clone | 28 | //! copy: clone |
@@ -390,7 +390,6 @@ pub mod iter { | |||
390 | iter: I, | 390 | iter: I, |
391 | n: usize, | 391 | n: usize, |
392 | } | 392 | } |
393 | |||
394 | impl<I> Iterator for Take<I> | 393 | impl<I> Iterator for Take<I> |
395 | where | 394 | where |
396 | I: Iterator, | 395 | I: Iterator, |
@@ -401,6 +400,22 @@ pub mod iter { | |||
401 | loop {} | 400 | loop {} |
402 | } | 401 | } |
403 | } | 402 | } |
403 | |||
404 | pub struct FilterMap<I, F> { | ||
405 | iter: I, | ||
406 | f: F, | ||
407 | } | ||
408 | impl<B, I: Iterator, F> Iterator for FilterMap<I, F> | ||
409 | where | ||
410 | F: FnMut(I::Item) -> Option<B>, | ||
411 | { | ||
412 | type Item = B; | ||
413 | |||
414 | #[inline] | ||
415 | fn next(&mut self) -> Option<B> { | ||
416 | loop {} | ||
417 | } | ||
418 | } | ||
404 | } | 419 | } |
405 | pub use self::adapters::Take; | 420 | pub use self::adapters::Take; |
406 | 421 | ||
@@ -448,6 +463,13 @@ pub mod iter { | |||
448 | fn take(self, n: usize) -> crate::iter::Take<Self> { | 463 | fn take(self, n: usize) -> crate::iter::Take<Self> { |
449 | loop {} | 464 | loop {} |
450 | } | 465 | } |
466 | fn filter_map<B, F>(self, f: F) -> crate::iter::FilterMap<Self, F> | ||
467 | where | ||
468 | Self: Sized, | ||
469 | F: FnMut(Self::Item) -> Option<B>, | ||
470 | { | ||
471 | loop {} | ||
472 | } | ||
451 | // endregion:iterators | 473 | // endregion:iterators |
452 | } | 474 | } |
453 | impl<I: Iterator + ?Sized> Iterator for &mut I { | 475 | impl<I: Iterator + ?Sized> Iterator for &mut I { |