From 04bb83f86efaece670f9c54e9fd834590f6ca759 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda <41065217+TaKO8Ki@users.noreply.github.com> Date: Wed, 2 Sep 2020 17:37:28 +0900 Subject: [PATCH] fix clippy warnings --- src/rt/mod.rs | 3 ++- src/stream/stream/inspect.rs | 4 ++-- src/task/builder.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rt/mod.rs b/src/rt/mod.rs index f58afb18..917db198 100644 --- a/src/rt/mod.rs +++ b/src/rt/mod.rs @@ -22,7 +22,8 @@ pub static RUNTIME: Lazy = Lazy::new(|| { .unwrap_or_else(|_| num_cpus::get()) .max(1); - let thread_name = env::var("ASYNC_STD_THREAD_NAME").unwrap_or("async-std/runtime".to_string()); + let thread_name = + env::var("ASYNC_STD_THREAD_NAME").unwrap_or_else(|_| "async-std/runtime".to_string()); for _ in 0..thread_count { thread::Builder::new() diff --git a/src/stream/stream/inspect.rs b/src/stream/stream/inspect.rs index 481810d7..d2f6cf39 100644 --- a/src/stream/stream/inspect.rs +++ b/src/stream/stream/inspect.rs @@ -41,9 +41,9 @@ where let mut this = self.project(); let next = futures_core::ready!(this.stream.as_mut().poll_next(cx)); - Poll::Ready(next.and_then(|x| { + Poll::Ready(next.map(|x| { (this.f)(&x); - Some(x) + x })) } } diff --git a/src/task/builder.rs b/src/task/builder.rs index 236081c0..d3a35369 100644 --- a/src/task/builder.rs +++ b/src/task/builder.rs @@ -41,7 +41,7 @@ impl Builder { #[cfg(not(target_os = "unknown"))] once_cell::sync::Lazy::force(&crate::rt::RUNTIME); - let tag = TaskLocalsWrapper::new(task.clone()); + let tag = TaskLocalsWrapper::new(task); SupportTaskLocals { tag, future } }