mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
chore: apply rustfmt to all crates (#917)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use super::chan;
|
||||
|
||||
use loom::sync::atomic::AtomicUsize;
|
||||
use futures::{Poll, Sink, StartSend, Stream};
|
||||
use loom::sync::atomic::AtomicUsize;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
@@ -15,7 +15,9 @@ pub struct UnboundedSender<T> {
|
||||
|
||||
impl<T> Clone for UnboundedSender<T> {
|
||||
fn clone(&self) -> Self {
|
||||
UnboundedSender { chan: self.chan.clone() }
|
||||
UnboundedSender {
|
||||
chan: self.chan.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,21 +99,17 @@ impl<T> Stream for UnboundedReceiver<T> {
|
||||
type Error = UnboundedRecvError;
|
||||
|
||||
fn poll(&mut self) -> Poll<Option<T>, Self::Error> {
|
||||
self.chan.recv()
|
||||
.map_err(|_| UnboundedRecvError(()))
|
||||
self.chan.recv().map_err(|_| UnboundedRecvError(()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl<T> UnboundedSender<T> {
|
||||
pub(crate) fn new(chan: chan::Tx<T, Semaphore>) -> UnboundedSender<T> {
|
||||
UnboundedSender { chan }
|
||||
}
|
||||
|
||||
/// Attempts to send a message on this `UnboundedSender` without blocking.
|
||||
pub fn try_send(&mut self, message: T)
|
||||
-> Result<(), UnboundedTrySendError<T>>
|
||||
{
|
||||
pub fn try_send(&mut self, message: T) -> Result<(), UnboundedTrySendError<T>> {
|
||||
self.chan.try_send(message)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user