Skip to content

Commit 5afd122

Browse files
committed
Remove leading underscores from parameter names in Sharded
With the removal of `cfg(parallel_compiler)`, these parameters are never considered unused.
1 parent 81d8edc commit 5afd122

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

compiler/rustc_data_structures/src/sharded.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ impl<T> Sharded<T> {
4343

4444
/// The shard is selected by hashing `val` with `FxHasher`.
4545
#[inline]
46-
pub fn get_shard_by_value<K: Hash + ?Sized>(&self, _val: &K) -> &Lock<T> {
46+
pub fn get_shard_by_value<K: Hash + ?Sized>(&self, val: &K) -> &Lock<T> {
4747
match self {
4848
Self::Single(single) => single,
49-
Self::Shards(..) => self.get_shard_by_hash(make_hash(_val)),
49+
Self::Shards(..) => self.get_shard_by_hash(make_hash(val)),
5050
}
5151
}
5252

@@ -56,20 +56,20 @@ impl<T> Sharded<T> {
5656
}
5757

5858
#[inline]
59-
pub fn get_shard_by_index(&self, _i: usize) -> &Lock<T> {
59+
pub fn get_shard_by_index(&self, i: usize) -> &Lock<T> {
6060
match self {
6161
Self::Single(single) => single,
6262
Self::Shards(shards) => {
6363
// SAFETY: The index gets ANDed with the shard mask, ensuring it is always inbounds.
64-
unsafe { &shards.get_unchecked(_i & (SHARDS - 1)).0 }
64+
unsafe { &shards.get_unchecked(i & (SHARDS - 1)).0 }
6565
}
6666
}
6767
}
6868

6969
/// The shard is selected by hashing `val` with `FxHasher`.
7070
#[inline]
7171
#[track_caller]
72-
pub fn lock_shard_by_value<K: Hash + ?Sized>(&self, _val: &K) -> LockGuard<'_, T> {
72+
pub fn lock_shard_by_value<K: Hash + ?Sized>(&self, val: &K) -> LockGuard<'_, T> {
7373
match self {
7474
Self::Single(single) => {
7575
// Synchronization is disabled so use the `lock_assume_no_sync` method optimized
@@ -79,7 +79,7 @@ impl<T> Sharded<T> {
7979
// `might_be_dyn_thread_safe` was also false.
8080
unsafe { single.lock_assume(Mode::NoSync) }
8181
}
82-
Self::Shards(..) => self.lock_shard_by_hash(make_hash(_val)),
82+
Self::Shards(..) => self.lock_shard_by_hash(make_hash(val)),
8383
}
8484
}
8585

@@ -91,7 +91,7 @@ impl<T> Sharded<T> {
9191

9292
#[inline]
9393
#[track_caller]
94-
pub fn lock_shard_by_index(&self, _i: usize) -> LockGuard<'_, T> {
94+
pub fn lock_shard_by_index(&self, i: usize) -> LockGuard<'_, T> {
9595
match self {
9696
Self::Single(single) => {
9797
// Synchronization is disabled so use the `lock_assume_no_sync` method optimized
@@ -109,7 +109,7 @@ impl<T> Sharded<T> {
109109
// always inbounds.
110110
// SAFETY (lock_assume_sync): We know `is_dyn_thread_safe` was true when creating
111111
// the lock thus `might_be_dyn_thread_safe` was also true.
112-
unsafe { shards.get_unchecked(_i & (SHARDS - 1)).0.lock_assume(Mode::Sync) }
112+
unsafe { shards.get_unchecked(i & (SHARDS - 1)).0.lock_assume(Mode::Sync) }
113113
}
114114
}
115115
}

0 commit comments

Comments
 (0)