Implement some clippy fixes

This commit is contained in:
Jonathan Kelley committed 2024-01-30 18:17:45 -08:00
1 parent a72c035de4
commit 09e14f1936
11 files changed
+103 -133

No files matched your search

+4 -7
View File
@@ -97,7 +97,7 @@ where
/// See the docs for [`use_coroutine`] for more details.
#[must_use]
pub fn use_coroutine_handle<M: 'static>() -> Coroutine<M> {
use_hook(|| consume_context::<Coroutine<M>>())
use_hook(consume_context::<Coroutine<M>>)
}
#[derive(PartialEq)]
@@ -110,7 +110,7 @@ pub struct Coroutine<T: 'static> {
impl<T> Coroutine<T> {
/// Get the underlying task handle
pub fn task(&self) -> Task {
self.task.read().clone().unwrap()
(*self.task.read()).unwrap()
}
/// Send a message to the coroutine
@@ -133,12 +133,9 @@ impl<T> Coroutine<T> {
// manual impl since deriving doesn't work with generics
impl<T> Copy for Coroutine<T> {}
impl<T> Clone for Coroutine<T> {
fn clone(&self) -> Self {
Self {
tx: self.tx,
task: self.task,
needs_regen: self.needs_regen,
}
*self
}
}
+2 -6
View File
@@ -39,13 +39,9 @@ where
let res = future::poll_fn(|cx| {
// Set the effect stack properly
// Poll the inner future
let ready = fut.poll_unpin(cx);
// add any dependencies to the effect stack that we need to watch when restarting the future
ready
// Poll the inner future
fut.poll_unpin(cx)
})
.await;