Skip to content

Commit 99d31ec

Browse files
authored
chore: replace lazy_static with std::sync::LazyLock (lance-format#4109)
This PR will replace lazy_static with std::sync::LazyLock. lazy_static is known to compile more slowly and relies on macros, which makes maintenance more difficult. Now that there is a new standard API that can fully replace it, this change is appropriate. --------- Signed-off-by: Xuanwo <github@xuanwo.io>
1 parent 27aa079 commit 99d31ec

41 files changed

Lines changed: 1063 additions & 898 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ humantime = "2.2.0"
126126
hyperloglogplus = { version = "0.4.1", features = ["const-loop"] }
127127
itertools = "0.13"
128128
jieba-rs = { version = "0.7", default-features = false }
129-
lazy_static = "1"
130129
log = "0.4"
131130
mockall = { version = "0.13.1" }
132131
mock_instant = { version = "0.3.1", features = ["sync"] }

java/core/lance-jni/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ object_store.workspace = true
2828
tokio.workspace = true
2929
jni = "0.21.1"
3030
snafu.workspace = true
31-
lazy_static.workspace = true
3231
serde = { version = "^1" }
3332
serde_json = { version = "1" }
3433
log.workspace = true

java/core/lance-jni/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ pub use ffi::JNIEnvExt;
6767
use env_logger::{Builder, Env};
6868
use std::sync::Arc;
6969

70-
use lazy_static::lazy_static;
70+
use std::sync::LazyLock;
7171

72-
lazy_static! {
73-
pub static ref RT: tokio::runtime::Runtime = tokio::runtime::Builder::new_multi_thread()
72+
pub static RT: LazyLock<tokio::runtime::Runtime> = LazyLock::new(|| {
73+
tokio::runtime::Builder::new_multi_thread()
7474
.enable_all()
7575
.build()
76-
.expect("Failed to create tokio runtime");
77-
}
76+
.expect("Failed to create tokio runtime")
77+
});
7878

7979
#[no_mangle]
8080
pub extern "system" fn Java_com_lancedb_lance_JniLoader_initLanceLogger() {

0 commit comments

Comments
 (0)