Skip to content

Commit 1a75679

Browse files
Minor: Removed dependency on the lazy_static crate. (#219)
The Required functionality is now in the standard library "use std::sync::LazyLock;" Minor as the change only effects profiling.
1 parent 52996aa commit 1a75679

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed

Cargo.lock

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

splashsurf_lib/Cargo.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ default-target = "x86_64-unknown-linux-gnu"
2222
targets = []
2323

2424
# Ignore the tests (especially the test mesh files) for publishing
25-
exclude = [
26-
"tests/*",
27-
"benches/*",
28-
]
25+
exclude = ["tests/*", "benches/*"]
2926

3027
[features]
3128
default = []
3229
vtk_extras = ["vtkio"]
33-
profiling = ["lazy_static"]
30+
profiling = []
3431
io = ["vtk_extras", "vtkio", "ply-rs", "nom", "serde_json", "flate2"]
3532

3633
[dependencies]
@@ -60,13 +57,12 @@ flate2 = { version = "1.0", optional = true }
6057
nom = { version = "7.1.3", optional = true }
6158
serde_json = { version = "1.0", optional = true }
6259

63-
# Needed for profiling feature
64-
lazy_static = { version = "1.4", optional = true }
65-
6660
[dev-dependencies]
6761
criterion = "0.5.1"
6862
ultraviolet = "0.9"
69-
sdfu = { git = "https://github.com/w1th0utnam3/sdfu", features = ["ultraviolet"], rev = "e39a4a8685a56a3430218b9f2dfd546ab2dbe2d6" }
63+
sdfu = { git = "https://github.com/w1th0utnam3/sdfu", features = [
64+
"ultraviolet",
65+
], rev = "e39a4a8685a56a3430218b9f2dfd546ab2dbe2d6" }
7066

7167
[[bench]]
7268
name = "splashsurf_lib_benches"

splashsurf_lib/src/profiling.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
//! Implementation details for the [`profile`](crate::profile) macro
22
3-
use lazy_static::lazy_static;
43
use parking_lot::RwLock;
54
use std::collections::hash_map::RandomState;
65
use std::collections::{HashMap, HashSet};
76
use std::error::Error;
87
use std::hash::{BuildHasher, Hash};
98
use std::io;
9+
use std::sync::LazyLock;
1010
use std::time::{Duration, Instant};
1111
use thread_local::ThreadLocal;
1212

13-
lazy_static! {
14-
/// Thread local storage of the [`Profiler`](Profiler)s storing all [`Scope`](Scope)s of the thread
15-
pub static ref PROFILER: ThreadLocal<RwLock<Profiler>> = ThreadLocal::new();
16-
/// `RandomState` used to obtain `Hasher`s to hash [`ScopeId`](ScopeId)s for parent/child identification
17-
pub static ref RANDOM_STATE: RandomState = RandomState::new();
18-
}
13+
/// Thread local storage of the [`Profiler`](Profiler)s storing all [`Scope`](Scope)s of the thread
14+
pub static PROFILER: LazyLock<ThreadLocal<RwLock<Profiler>>> = LazyLock::new(ThreadLocal::new);
15+
16+
/// `RandomState` used to obtain `Hasher`s to hash [`ScopeId`](ScopeId)s for parent/child identification
17+
pub static RANDOM_STATE: LazyLock<RandomState> = LazyLock::new(RandomState::new);
1918

2019
/// Implementation of the profile macro, use [`profile`](crate::profile) instead
2120
#[doc(hidden)]

0 commit comments

Comments
 (0)