diff options
author | Griffin Smith <root@gws.fyi> | 2019-08-03T17·14-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-08-04T00·31-0400 |
commit | 82cefedab9e44b48f4d3cc08b0f6e002ae383c9d (patch) | |
tree | adc553136987cdbd69caf9e1aa362d1974c57afd /src/util/promise.rs | |
parent | 929dac06d0a2df78bbeac5a80c994a38901e5f67 (diff) |
Fix a bunch more Clippy lints, but disable in Circle
The unused error is causing more trouble than it's worth at this point
Diffstat (limited to 'src/util/promise.rs')
-rw-r--r-- | src/util/promise.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/promise.rs b/src/util/promise.rs index 63fbca1ddc18..22f1e8b47f58 100644 --- a/src/util/promise.rs +++ b/src/util/promise.rs @@ -3,9 +3,11 @@ use std::pin::Pin; use std::sync::{Arc, RwLock}; use std::task::{Context, Poll, Waker}; +type Waiter<Env, T> = Box<dyn Fn(&mut Env, &T)>; + pub struct Promise<Env, T> { inner: Arc<RwLock<Inner<T>>>, - waiters: Arc<RwLock<Vec<Box<dyn Fn(&mut Env, &T)>>>>, + waiters: Arc<RwLock<Vec<Waiter<Env, T>>>>, } pub struct Complete<T> { @@ -29,7 +31,7 @@ pub fn promise<Env, T>() -> (Complete<T>, Promise<Env, T>) { inner: inner.clone(), waiters: Arc::new(RwLock::new(Vec::new())), }; - let complete = Complete { inner: inner }; + let complete = Complete { inner }; (complete, promise) } @@ -127,7 +129,7 @@ impl<Env, P: Give<Env>> Give<Env> for &P { impl<Env, T> Future for Promise<Env, T> { type Output = Arc<T>; - fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> { + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { let mut inner = self.inner.write().unwrap(); match inner.value { Some(ref v) => Poll::Ready(v.clone()), |