Skip to content

Commit

Permalink
Fix Clippy warnings
Browse files Browse the repository at this point in the history
clippy 0.1.72 (a47f796a365 2023-07-22)
  • Loading branch information
tatsuya6502 committed Jul 28, 2023
1 parent d74d1e3 commit 876302a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/cht/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ mod tests {

for result in insert_threads
.into_iter()
.chain(remove_threads.into_iter())
.chain(remove_threads)
.map(|t| t.join())
{
assert!(result.is_ok());
Expand Down Expand Up @@ -1039,7 +1039,7 @@ mod tests {

for result in insert_threads
.into_iter()
.chain(remove_threads.into_iter())
.chain(remove_threads)
.map(JoinHandle::join)
{
assert!(result.is_ok());
Expand Down
2 changes: 1 addition & 1 deletion src/common/frequency_sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ mod tests {
let mut sketch = FrequencySketch::default();
sketch.ensure_capacity(512);
let mut indexes = std::collections::HashSet::new();
let hashes = vec![std::u64::MAX, 0, 1];
let hashes = [std::u64::MAX, 0, 1];
for hash in hashes.iter() {
for depth in 0..4 {
indexes.insert(sketch.index_of(*hash, depth));
Expand Down
1 change: 1 addition & 0 deletions src/notification/notifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ impl<K, V> ThreadPoolRemovalNotifier<K, V> {
};
Self {
snd,
#[allow(clippy::arc_with_non_send_sync)]
state: Arc::new(state),

Check failure on line 164 in src/notification/notifier.rs

View workflow job for this annotation

GitHub Actions / clippy

usage of `Arc<T>` where `T` is not `Send` or `Sync`

error: usage of `Arc<T>` where `T` is not `Send` or `Sync` --> src/notification/notifier.rs:164:20 | 164 | state: Arc::new(state), | ^^^^^^^^^^^^^^^ | = help: consider using `Rc<T>` instead or wrapping `T` in a std::sync type like `Mutex<T>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync = note: `-D clippy::arc-with-non-send-sync` implied by `-D warnings`

Check failure on line 164 in src/notification/notifier.rs

View workflow job for this annotation

GitHub Actions / clippy

usage of `Arc<T>` where `T` is not `Send` or `Sync`

error: usage of `Arc<T>` where `T` is not `Send` or `Sync` --> src/notification/notifier.rs:164:20 | 164 | state: Arc::new(state), | ^^^^^^^^^^^^^^^ | = help: consider using `Rc<T>` instead or wrapping `T` in a std::sync type like `Mutex<T>` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync = note: `-D clippy::arc-with-non-send-sync` implied by `-D warnings`
thread_pool,
}
Expand Down
18 changes: 9 additions & 9 deletions src/sync/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -3291,7 +3291,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -3426,7 +3426,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3565,7 +3565,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3704,7 +3704,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3843,7 +3843,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -3972,7 +3972,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -4101,7 +4101,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -4459,7 +4459,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3] {
for t in [thread1, thread2, thread3] {
t.join().expect("Failed to join");
}

Expand Down
8 changes: 4 additions & 4 deletions src/sync/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ mod tests {
})
};

for t in vec![thread1, thread2, thread3, thread4, thread5] {
for t in [thread1, thread2, thread3, thread4, thread5] {
t.join().expect("Failed to join");
}
}
Expand Down Expand Up @@ -1598,7 +1598,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -1736,7 +1736,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down Expand Up @@ -1865,7 +1865,7 @@ mod tests {
})
};

for t in vec![
for t in [
thread1, thread2, thread3, thread4, thread5, thread6, thread7, thread8,
] {
t.join().expect("Failed to join");
Expand Down
6 changes: 4 additions & 2 deletions src/sync_base/base_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ where
let (r_snd, r_rcv) = crossbeam_channel::bounded(r_size);
let (w_snd, w_rcv) = crossbeam_channel::bounded(w_size);

#[allow(clippy::arc_with_non_send_sync)]
let inner = Arc::new(Inner::new(
name,
max_capacity,
Expand All @@ -192,12 +193,13 @@ where
if invalidator_enabled {
inner.set_invalidator(&inner);
}
let housekeeper = Housekeeper::new(Arc::downgrade(&inner), housekeeper_conf);
#[allow(clippy::arc_with_non_send_sync)]
let housekeeper = Arc::new(Housekeeper::new(Arc::downgrade(&inner), housekeeper_conf));
Self {
inner,
read_op_ch: r_snd,
write_op_ch: w_snd,
housekeeper: Some(Arc::new(housekeeper)),
housekeeper: Some(housekeeper),
}
}

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

0 comments on commit 876302a

Please sign in to comment.