Skip to content

Commit

Permalink
rustfmt and clippy
Browse files Browse the repository at this point in the history
- Apply rustfmt for `if let ... else`.
- Remove allow `clippy::arc_with_non_send_sync` as the false positives are fixed
  in Clippy.
  • Loading branch information
tatsuya6502 committed Aug 25, 2023
1 parent 6b045b6 commit 4460d44
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
16 changes: 12 additions & 4 deletions src/cht/map/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ impl<'g, K: 'g + Eq, V: 'g> BucketArray<K, V> {
mut eq: impl FnMut(&K) -> bool,
) -> Result<Shared<'g, Bucket<K, V>>, RelocatedError> {
for bucket in self.probe(guard, hash) {
let Ok((_, _, this_bucket_ptr)) = bucket else { return Err(RelocatedError); };
let Ok((_, _, this_bucket_ptr)) = bucket else {
return Err(RelocatedError);
};

let this_bucket_ref = if let Some(r) = unsafe { this_bucket_ptr.as_ref() } {
r
Expand Down Expand Up @@ -121,7 +123,9 @@ impl<'g, K: 'g + Eq, V: 'g> BucketArray<K, V> {
{
let mut probe = self.probe(guard, hash);
while let Some(bucket) = probe.next() {
let Ok((_, this_bucket, this_bucket_ptr)) = bucket else { return Err(condition); };
let Ok((_, this_bucket, this_bucket_ptr)) = bucket else {
return Err(condition);
};

let this_bucket_ref = if let Some(r) = unsafe { this_bucket_ptr.as_ref() } {
r
Expand Down Expand Up @@ -233,7 +237,9 @@ impl<'g, K: 'g + Eq, V: 'g> BucketArray<K, V> {
{
let mut probe = self.probe(guard, hash);
while let Some(bucket) = probe.next() {
let Ok((_, this_bucket, this_bucket_ptr)) = bucket else { return Err((state, modifier)); };
let Ok((_, this_bucket, this_bucket_ptr)) = bucket else {
return Err((state, modifier));
};

let (new_bucket, maybe_insert_value) =
if let Some(this_bucket_ref) = unsafe { this_bucket_ptr.as_ref() } {
Expand Down Expand Up @@ -294,7 +300,9 @@ impl<'g, K: 'g + Eq, V: 'g> BucketArray<K, V> {

let mut probe = self.probe(guard, hash);
while let Some(bucket) = probe.next() {
let Ok((i, this_bucket, this_bucket_ptr)) = bucket else { return None; };
let Ok((i, this_bucket, this_bucket_ptr)) = bucket else {
return None;
};

if let Some(Bucket { key: this_key, .. }) = unsafe { this_bucket_ptr.as_ref() } {
if this_bucket_ptr == bucket_ptr {
Expand Down
6 changes: 1 addition & 5 deletions src/notification/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,9 @@ impl<K, V> ThreadPoolRemovalNotifier<K, V> {
is_running: Default::default(),
is_shutting_down: Default::default(),
};

#[cfg_attr(beta_clippy, allow(clippy::arc_with_non_send_sync))]
let state = Arc::new(state);

Self {
snd,
state,
state: Arc::new(state),
thread_pool,
}
}
Expand Down
1 change: 0 additions & 1 deletion src/sync_base/invalidator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl<K, V, S> Invalidator<K, V, S> {
Self {
predicates: RwLock::new(HashMap::new()),
is_empty: AtomicBool::new(true),
#[cfg_attr(beta_clippy, allow(clippy::arc_with_non_send_sync))]
scan_context: Arc::new(ScanContext::new(cache)),
thread_pool,
}
Expand Down

0 comments on commit 4460d44

Please sign in to comment.