diff options
author | Artem Vorotnikov <artem@vorotnikov.me> | 2019-12-21 23:28:57 +0300 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-12-21 12:28:57 -0800 |
commit | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 (patch) | |
tree | e2fd1f95216660edeaadebbce87144e95ccfffde /tokio/src/sync/broadcast.rs | |
parent | f309b295bb0bdee5862a0ab8359a5f0622a588b9 (diff) |
chore: fix formatting, remove old rustfmt.toml (#2007)
`cargo fmt` has a bug where it does not format modules scoped with
feature flags.
Diffstat (limited to 'tokio/src/sync/broadcast.rs')
-rw-r--r-- | tokio/src/sync/broadcast.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index 093aa1f3..fd9029a7 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -109,8 +109,8 @@ use crate::loom::cell::CausalCell; use crate::loom::future::AtomicWaker; -use crate::loom::sync::{Mutex, Arc, Condvar}; -use crate::loom::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize, spin_loop_hint}; +use crate::loom::sync::atomic::{spin_loop_hint, AtomicBool, AtomicPtr, AtomicUsize}; +use crate::loom::sync::{Arc, Condvar, Mutex}; use std::fmt; use std::ptr; @@ -387,10 +387,7 @@ pub fn channel<T>(mut capacity: usize) -> (Sender<T>, Receiver<T>) { let shared = Arc::new(Shared { buffer: buffer.into_boxed_slice(), mask: capacity - 1, - tail: Mutex::new(Tail { - pos: 0, - rx_cnt: 1, - }), + tail: Mutex::new(Tail { pos: 0, rx_cnt: 1 }), condvar: Condvar::new(), wait_stack: AtomicPtr::new(ptr::null_mut()), num_tx: AtomicUsize::new(1), @@ -406,9 +403,7 @@ pub fn channel<T>(mut capacity: usize) -> (Sender<T>, Receiver<T>) { }), }; - let tx = Sender { - shared, - }; + let tx = Sender { shared }; (tx, rx) } @@ -852,7 +847,10 @@ where // access to `self.wait.next`. self.wait.next.with_mut(|ptr| unsafe { *ptr = curr }); - let res = self.shared.wait_stack.compare_exchange(curr, node, SeqCst, SeqCst); + let res = self + .shared + .wait_stack + .compare_exchange(curr, node, SeqCst, SeqCst); match res { Ok(_) => return, |