From 2b668bd2bf2ea8241f5d7a674e9dbe0e3b749c70 Mon Sep 17 00:00:00 2001 From: PSeitz Date: Wed, 9 Apr 2025 00:28:49 +0800 Subject: [PATCH] readability improvement on executor (#2615) --- src/core/executor.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/executor.rs b/src/core/executor.rs index 2fe47555a..f8540eb9e 100644 --- a/src/core/executor.rs +++ b/src/core/executor.rs @@ -41,16 +41,12 @@ impl Executor { /// /// Regardless of the executor (`SingleThread` or `ThreadPool`), panics in the task /// will propagate to the caller. - pub fn map< + pub fn map(&self, f: F, args: impl Iterator) -> crate::Result> + where A: Send, R: Send, - AIterator: Iterator, F: Sized + Sync + Fn(A) -> crate::Result, - >( - &self, - f: F, - args: AIterator, - ) -> crate::Result> { + { match self { Executor::SingleThread => args.map(f).collect::>(), Executor::ThreadPool(pool) => {