From 90da9fc9b302de46097065f0d6428ad33c292217 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 18 Jun 2021 23:48:18 +0300 Subject: minor: use minicore --- crates/test_utils/src/minicore.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'crates/test_utils') 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 @@ //! option: //! result: //! iterator: option -//! iterators: iterator +//! iterators: iterator, fn //! default: sized //! clone: sized //! copy: clone @@ -390,7 +390,6 @@ pub mod iter { iter: I, n: usize, } - impl Iterator for Take where I: Iterator, @@ -401,6 +400,22 @@ pub mod iter { loop {} } } + + pub struct FilterMap { + iter: I, + f: F, + } + impl Iterator for FilterMap + where + F: FnMut(I::Item) -> Option, + { + type Item = B; + + #[inline] + fn next(&mut self) -> Option { + loop {} + } + } } pub use self::adapters::Take; @@ -448,6 +463,13 @@ pub mod iter { fn take(self, n: usize) -> crate::iter::Take { loop {} } + fn filter_map(self, f: F) -> crate::iter::FilterMap + where + Self: Sized, + F: FnMut(Self::Item) -> Option, + { + loop {} + } // endregion:iterators } impl Iterator for &mut I { -- cgit v1.2.3