Skip to content

Commit b552900

Browse files
remove array!, use const to shorten array.
1 parent b1a24d3 commit b552900

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

crossbeam-utils/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ nightly = []
3434
[dependencies]
3535
cfg-if = "1"
3636
lazy_static = { version = "1.4.0", optional = true }
37-
array-macro = "2.1.0"
3837

3938
# Enable the use of loom for concurrency testing.
4039
#

crossbeam-utils/src/atomic/atomic_cell.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![allow(clippy::let_unit_value)]
44

55
use crate::primitive::sync::atomic::{self, AtomicBool};
6-
use array_macro::array;
76
use core::cell::UnsafeCell;
87
use core::fmt;
98
use core::mem;
@@ -684,8 +683,13 @@ fn lock(addr: usize) -> &'static SeqLock {
684683
// stored at addresses that are multiples of 3. It'd be too bad if `LEN` was divisible by 3.
685684
// In order to protect from such cases, we simply choose a large prime number for `LEN`.
686685
const LEN: usize = 97;
687-
688-
static LOCKS: [SeqLock; LEN] = array![_ => SeqLock::new(); LEN];
686+
const L: SeqLock = SeqLock::new();
687+
static LOCKS: [SeqLock; LEN] = [
688+
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
689+
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
690+
L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L,
691+
L, L, L, L, L, L, L,
692+
];
689693

690694
// If the modulus is a constant number, the compiler will use crazy math to transform this into
691695
// a sequence of cheap arithmetic operations rather than using the slow modulo instruction.

0 commit comments

Comments
 (0)