Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all warnings from the latest Clippy #1123

Merged
merged 7 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
] }
unreachable_pub = "warn"
# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV

[workspace.lints.clippy]
# Suppress buggy or noisy clippy lints
declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665
3 changes: 2 additions & 1 deletion crossbeam-channel/src/select_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,10 @@ macro_rules! crossbeam_channel_internal {
) => {{
const _LEN: usize = $crate::crossbeam_channel_internal!(@count ($($cases)*));
let _handle: &dyn $crate::internal::SelectHandle = &$crate::never::<()>();
let _entry = (_handle, 0, ::std::ptr::null());

#[allow(unused_mut)]
let mut _sel = [(_handle, 0, ::std::ptr::null()); _LEN];
let mut _sel = [_entry; _LEN];
taiki-e marked this conversation as resolved.
Show resolved Hide resolved

$crate::crossbeam_channel_internal!(
@add
Expand Down
6 changes: 3 additions & 3 deletions crossbeam-skiplist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
//! A solution to the above is to have the implementation wrap
//! each value in a lock. However, this has some repercussions:
//! * The map would no longer be lock-free, inhibiting scalability
//! and allowing for deadlocks.
//! and allowing for deadlocks.
//! * If a user of the map doesn't need mutable access, then they pay
//! the price of locks without actually needing them.
//! the price of locks without actually needing them.
//!
//! Instead, the approach taken by this crate gives more control to the user.
//! If mutable access is needed, then you can use interior mutability,
Expand Down Expand Up @@ -150,7 +150,7 @@
//! Crossbeam [does not currently provide a concurrent unordered map](https://github.com/crossbeam-rs/rfcs/issues/32).
//! That said, here are some other crates which may suit you:
//! * [`DashMap`](https://docs.rs/dashmap) implements a novel concurrent hash map
//! with good performance characteristics.
//! with good performance characteristics.
//! * [`flurry`](https://docs.rs/flurry) is a Rust port of Java's `ConcurrentHashMap`.
//!
//! [`insert`]: SkipMap::insert
Expand Down
1 change: 0 additions & 1 deletion crossbeam-utils/src/atomic/atomic_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,6 @@ fn lock(addr: usize) -> &'static SeqLock {
// stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
// In order to protect from such cases, we simply choose a large prime number for `LEN`.
const LEN: usize = 67;
#[allow(clippy::declare_interior_mutable_const)]
const L: CachePadded<SeqLock> = CachePadded::new(SeqLock::new());
static LOCKS: [CachePadded<SeqLock>; LEN] = [L; LEN];

Expand Down