Skip to content

Commit b1cba08

Browse files
authored
Merge pull request #88 from athenavm/cleanup/remove-lazy_static-dep
use `std::sync::LazyLock` in place of `lazy_static!`
2 parents 0fbaf7d + 8921d60 commit b1cba08

6 files changed

Lines changed: 3 additions & 13 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ runs:
2727
uses: actions-rust-lang/setup-rust-toolchain@v1
2828
with:
2929
components: clippy, rustfmt
30-
toolchain: nightly-2024-04-17

.github/workflows/pr.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ jobs:
4747
uses: actions-rs/cargo@v1
4848
with:
4949
command: check
50-
toolchain: nightly-2024-04-17
5150
args: --all-targets --all-features
5251

5352
- name: Run cargo test
5453
uses: actions-rs/cargo@v1
5554
with:
5655
command: test
57-
toolchain: nightly-2024-04-17
5856
args: --release
5957
env:
6058
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ jobs:
122122
id: rustc-toolchain
123123
uses: actions-rust-lang/setup-rust-toolchain@v1
124124
with:
125-
toolchain: nightly-2024-05-29
126125
target: ${{ matrix.target }}
127126

128127
- name: Apple M1 setup

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ repository = "https://github.com/athenavm/athena"
2626
homepage = "https://www.athenavm.org/"
2727
license = "MIT OR Apache-2.0"
2828
edition = "2021"
29-
30-
[workspace.dependencies]

vm/entrypoint/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ cfg-if = "1.0.0"
1616
getrandom = { version = "0.2.14", features = ["custom"] }
1717
serde = { version = "1.0.204", features = ["derive"] }
1818
rand = "0.8.5"
19-
lazy_static = "1.5.0"
2019

2120
# optional
2221
athena-lib = { path = "../lib", optional = true }

vm/entrypoint/src/syscalls/sys.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use std::sync::Mutex;
1+
use std::sync::{LazyLock, Mutex};
22

3-
use lazy_static::lazy_static;
43
use rand::{rngs::StdRng, Rng, SeedableRng};
54

65
use crate::syscalls::{syscall_halt, syscall_write};
@@ -10,10 +9,8 @@ use crate::syscalls::{syscall_halt, syscall_write};
109
/// In the future, we can pass in this seed from the host or have the verifier generate it.
1110
const PRNG_SEED: u64 = 0x123456789abcdef0;
1211

13-
lazy_static! {
14-
/// A lazy static to generate a global random number generator.
15-
static ref RNG: Mutex<StdRng> = Mutex::new(StdRng::seed_from_u64(PRNG_SEED));
16-
}
12+
static RNG: LazyLock<Mutex<StdRng>> =
13+
LazyLock::new(|| Mutex::new(StdRng::seed_from_u64(PRNG_SEED)));
1714

1815
/// A lazy static to print a warning once for using the `sys_rand` system call.
1916
static SYS_RAND_WARNING: std::sync::Once = std::sync::Once::new();

0 commit comments

Comments
 (0)