Skip to content

Commit

Permalink
Use wildcard import to reduce diff
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Sep 19, 2023
1 parent 9f1723b commit e5daae7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tokio/src/sync/watch.rs
Expand Up @@ -114,7 +114,7 @@
use crate::sync::notify::Notify;

use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::atomic::Ordering;
use crate::loom::sync::atomic::Ordering::*;
use crate::loom::sync::{Arc, RwLock, RwLockReadGuard};
use std::fmt;
use std::mem;
Expand Down Expand Up @@ -248,7 +248,7 @@ struct Shared<T> {
impl<T: fmt::Debug> fmt::Debug for Shared<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Using `Relaxed` ordering is sufficient for this purpose.
let state = self.state.load(Ordering::Relaxed);
let state = self.state.load(Relaxed);
f.debug_struct("Shared")
.field("value", &self.value)
.field("version", &state.version())
Expand Down Expand Up @@ -342,7 +342,7 @@ mod big_notify {
/// This function implements the case where randomness is not available.
#[cfg(not(all(not(loom), feature = "sync", any(feature = "rt", feature = "macros"))))]
pub(super) fn notified(&self) -> Notified<'_> {
let i = self.next.fetch_add(1, Ordering::Relaxed) % 8;
let i = self.next.fetch_add(1, Relaxed) % 8;
self.inner[i].notified()
}

Expand Down Expand Up @@ -509,7 +509,7 @@ impl<T> Receiver<T> {
fn from_shared(version: Version, shared: Arc<Shared<T>>) -> Self {
// No synchronization necessary as this is only used as a counter and
// not memory access.
shared.ref_count_rx.fetch_add(1, Ordering::Relaxed);
shared.ref_count_rx.fetch_add(1, Relaxed);

Self { shared, version }
}
Expand Down Expand Up @@ -885,7 +885,7 @@ impl<T> Drop for Receiver<T> {
fn drop(&mut self) {
// No synchronization necessary as this is only used as a counter and
// not memory access.
if 1 == self.shared.ref_count_rx.fetch_sub(1, Ordering::Relaxed) {
if 1 == self.shared.ref_count_rx.fetch_sub(1, Relaxed) {
// This is the last `Receiver` handle, tasks waiting on `Sender::closed()`
self.shared.notify_tx.notify_waiters();
}
Expand Down Expand Up @@ -1274,7 +1274,7 @@ impl<T> Sender<T> {
/// }
/// ```
pub fn receiver_count(&self) -> usize {
self.shared.ref_count_rx.load(Ordering::Relaxed)
self.shared.ref_count_rx.load(Relaxed)
}
}

Expand Down

0 comments on commit e5daae7

Please sign in to comment.