Skip to content

Commit 5e06b20

Browse files
committed
Remove lazy_static! for ATOMIC_COUNTER
`AtomicU32::new` is a `const fn`, so we don't need lazy initialization. This reduces the number of operations needed to increment the counter.
1 parent ce48c99 commit 5e06b20

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bambulabs/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ anyhow = "1.0.95"
88
dashmap = "6.1.0"
99
format_serde_error = { version = "0.3.0", default-features = false, features = ["serde_json"] }
1010
include_dir = { version = "0.7.4", features = ["glob"] }
11-
lazy_static = "1.5.0"
1211
nanoid = "0.4.0"
1312
parse-display = "0.10.0"
1413
rumqttc = "0.24.0"

bambulabs/src/sequence_id.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ use parse_display::{Display, FromStr};
77
use schemars::JsonSchema;
88
use serde::{Deserialize, Serialize};
99

10-
lazy_static::lazy_static! {
11-
/// The atomic counter for sequence IDs.
12-
pub static ref ATOMIC_COUNTER: AtomicU32 = AtomicU32::new(0);
13-
}
10+
/// The atomic counter for sequence IDs.
11+
pub static ATOMIC_COUNTER: AtomicU32 = AtomicU32::new(0);
1412

1513
/// The sequence id type.
1614
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, Display, FromStr)]

0 commit comments

Comments
 (0)