diff --git a/Cargo.lock b/Cargo.lock index 9cc97fceadc..f2e7a2d9d28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7725,7 +7725,6 @@ dependencies = [ "iai-callgrind-macros", "iai-callgrind-runner", "itertools 0.12.1", - "lazy_static", "log", "mimalloc", "rand 0.9.2", @@ -7902,7 +7901,6 @@ dependencies = [ "hyper-util", "itoa", "jemalloc_pprof", - "lazy_static", "log", "mime", "pretty_assertions", @@ -8052,7 +8050,6 @@ dependencies = [ "imara-diff", "indexmap 2.12.0", "itertools 0.12.1", - "lazy_static", "log", "memchr", "nix 0.30.1", @@ -8162,7 +8159,6 @@ dependencies = [ "enum-as-inner", "enum-map", "itertools 0.12.1", - "lazy_static", "log", "once_cell", "parking_lot 0.12.5", @@ -8542,7 +8538,6 @@ dependencies = [ "indexmap 2.12.0", "insta", "itertools 0.12.1", - "lazy_static", "lean_string", "petgraph 0.6.5", "proptest", @@ -8764,7 +8759,6 @@ dependencies = [ "duct", "env_logger 0.10.2", "futures", - "lazy_static", "log", "rand 0.9.2", "serde", diff --git a/Cargo.toml b/Cargo.toml index 120ec24c2cf..2421ecff4fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -228,7 +228,7 @@ json5 = "0.4" jsonwebtoken = { package = "spacetimedb-jsonwebtoken", version = "9.3.0" } junction = "1" jwks = { package = "spacetimedb-jwks", version = "0.1.3" } -lazy_static = "1.4.0" + lean_string = "0.5.1" log = "0.4.17" memchr = "2" diff --git a/crates/bench/Cargo.toml b/crates/bench/Cargo.toml index 115eb115022..868bf228848 100644 --- a/crates/bench/Cargo.toml +++ b/crates/bench/Cargo.toml @@ -63,7 +63,7 @@ criterion.workspace = true futures.workspace = true foldhash.workspace = true hashbrown.workspace = true -lazy_static.workspace = true + log.workspace = true mimalloc.workspace = true rand.workspace = true diff --git a/crates/bench/benches/generic.rs b/crates/bench/benches/generic.rs index 1013566df8b..a3816c6a963 100644 --- a/crates/bench/benches/generic.rs +++ b/crates/bench/benches/generic.rs @@ -3,7 +3,6 @@ use criterion::{ measurement::{Measurement, WallTime}, Bencher, BenchmarkGroup, Criterion, }; -use lazy_static::lazy_static; use spacetimedb_bench::{ database::BenchDatabase, schemas::{create_sequential, u32_u64_str, u32_u64_u64, BenchTable, IndexStrategy, RandomTable}, @@ -24,9 +23,8 @@ use tikv_jemallocator::Jemalloc; #[global_allocator] static GLOBAL: Jemalloc = Jemalloc; -lazy_static! { - static ref RUN_ONE_MILLION: bool = std::env::var("RUN_ONE_MILLION").is_ok(); -} +static RUN_ONE_MILLION: std::sync::LazyLock = + std::sync::LazyLock::new(|| std::env::var("RUN_ONE_MILLION").is_ok()); fn criterion_benchmark(c: &mut Criterion) { bench_suite::(c, true).unwrap(); diff --git a/crates/bench/src/bin/summarize.rs b/crates/bench/src/bin/summarize.rs index 72dd32d0ba9..d0b53c2174a 100644 --- a/crates/bench/src/bin/summarize.rs +++ b/crates/bench/src/bin/summarize.rs @@ -67,8 +67,6 @@ fn main() { mod criterion { use std::path::{Path, PathBuf}; - use regex::Regex; - pub fn pack(baseline_name: String, target_dir: &Path) { assert!( !baseline_name.ends_with(".json"), @@ -102,10 +100,6 @@ mod criterion { crit_dir.join(format!("{name}.json")) } - lazy_static::lazy_static! { - static ref EMOJI: Regex = Regex::new(r"(on_disk|mem)").unwrap(); - } - /// Data types for deserializing stored Criterion benchmark results. /// /// Unfortunately, there is no published library for this, so we use the schema diff --git a/crates/bench/src/sqlite.rs b/crates/bench/src/sqlite.rs index d1d366da406..afecf4905a4 100644 --- a/crates/bench/src/sqlite.rs +++ b/crates/bench/src/sqlite.rs @@ -3,7 +3,7 @@ use crate::{ schemas::{table_name, BenchTable, IndexStrategy}, ResultBench, }; -use lazy_static::lazy_static; + use rusqlite::Connection; use spacetimedb_data_structures::map::HashMap; use spacetimedb_lib::sats::{AlgebraicType, AlgebraicValue, ProductType}; @@ -12,7 +12,7 @@ use spacetimedb_schema::table_name::TableName; use std::{ fmt::Write, hint::black_box, - sync::{Arc, RwLock}, + sync::{Arc, LazyLock, RwLock}, }; use tempdir::TempDir; @@ -253,12 +253,9 @@ fn memo_query String>(bench_name: BenchName, table_id: &str, gene } } -lazy_static! { - // bench_name -> table_id -> query. - // Double hashmap is necessary because of tuple dereferencing problems. - static ref QUERIES: RwLock>>> = - RwLock::default(); -} +// bench_name -> table_id -> query. +// Double hashmap is necessary because of tuple dereferencing problems. +static QUERIES: LazyLock>>>> = LazyLock::new(RwLock::default); #[inline(never)] fn insert_template(table_id: &str, product_type: ProductType) -> String { diff --git a/crates/client-api/Cargo.toml b/crates/client-api/Cargo.toml index a3da402e734..bab70d1e328 100644 --- a/crates/client-api/Cargo.toml +++ b/crates/client-api/Cargo.toml @@ -17,7 +17,7 @@ spacetimedb-schema.workspace = true base64.workspace = true tokio = { version = "1.2", features = ["full"] } -lazy_static = "1.4.0" + log = "0.4.4" serde = "1.0.136" serde_json = { version = "1.0", features = ["raw_value"] } diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 704d9af6c4c..146d50f2a4b 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -70,7 +70,7 @@ imara-diff.workspace = true indexmap.workspace = true itertools.workspace = true jsonwebtoken.workspace = true -lazy_static.workspace = true + log.workspace = true memchr.workspace = true nohash-hasher.workspace = true diff --git a/crates/core/src/auth/token_validation.rs b/crates/core/src/auth/token_validation.rs index c38d732882d..6baec636971 100644 --- a/crates/core/src/auth/token_validation.rs +++ b/crates/core/src/auth/token_validation.rs @@ -9,7 +9,7 @@ pub use jsonwebtoken::errors::ErrorKind as JwtErrorKind; use jsonwebtoken::{decode, Validation}; pub use jsonwebtoken::{DecodingKey, EncodingKey}; use jwks::Jwks; -use lazy_static::lazy_static; + use serde::Serialize; use std::sync::Arc; use std::time::Duration; @@ -137,10 +137,8 @@ struct BasicTokenValidator { pub issuer: Option>, } -lazy_static! { - // Eventually we will want to add more required claims. - static ref REQUIRED_CLAIMS: Vec<&'static str> = vec!["sub", "iss"]; -} +// Eventually we will want to add more required claims. +const REQUIRED_CLAIMS: [&str; 2] = ["sub", "iss"]; #[async_trait] impl TokenValidator for DecodingKey { diff --git a/crates/datastore/Cargo.toml b/crates/datastore/Cargo.toml index 86cb2aca0b6..a0ec9eb8a7b 100644 --- a/crates/datastore/Cargo.toml +++ b/crates/datastore/Cargo.toml @@ -26,7 +26,7 @@ derive_more.workspace = true enum-as-inner.workspace = true enum-map.workspace = true itertools.workspace = true -lazy_static.workspace = true + log.workspace = true once_cell.workspace = true parking_lot.workspace = true diff --git a/crates/datastore/src/system_tables.rs b/crates/datastore/src/system_tables.rs index e75cc76b365..f3b3638b9b2 100644 --- a/crates/datastore/src/system_tables.rs +++ b/crates/datastore/src/system_tables.rs @@ -39,6 +39,7 @@ use spacetimedb_table::table::RowRef; use std::borrow::Cow; use std::cell::RefCell; use std::str::FromStr; +use std::sync::LazyLock; use strum::Display; use v9::{RawModuleDefV9Builder, TableType}; @@ -697,107 +698,99 @@ fn system_module_def() -> ModuleDef { result } -lazy_static::lazy_static! { - /// The canonical definition of the system tables. - /// - /// It's important not to leak this `ModuleDef` or the `Def`s it contains outside this file. - /// You should only return `Schema`s from this file, not `Def`s! - /// - /// This is because `SYSTEM_MODULE_DEF` has a `Typespace` that is DISTINCT from the typespace used in the client module. - /// System `TableDef`s refer to this typespace, but client `TableDef`s refer to the client typespace. - /// This could easily result in confusing errors! - /// Fortunately, when converting from `TableDef` to `TableSchema`, all `AlgebraicType`s are resolved, - /// so that they are self-contained and do not refer to any `Typespace`. - static ref SYSTEM_MODULE_DEF: ModuleDef = system_module_def(); -} +/// The canonical definition of the system tables. +/// +/// It's important not to leak this `ModuleDef` or the `Def`s it contains outside this file. +/// You should only return `Schema`s from this file, not `Def`s! +/// +/// This is because `SYSTEM_MODULE_DEF` has a `Typespace` that is DISTINCT from the typespace used in the client module. +/// System `TableDef`s refer to this typespace, but client `TableDef`s refer to the client typespace. +/// This could easily result in confusing errors! +/// Fortunately, when converting from `TableDef` to `TableSchema`, all `AlgebraicType`s are resolved, +/// so that they are self-contained and do not refer to any `Typespace`. +static SYSTEM_MODULE_DEF: LazyLock = LazyLock::new(system_module_def); -lazy_static::lazy_static! { // We enumerate the constraints used by system tables here, so that we can assign them stable IDs. // When adding a new index, we just need to make sure we are incrementing the last ID used. - pub static ref CONSTRAINT_IDS: HashMap<&'static str, ConstraintId> = { - let mut m = HashMap::new(); - m.insert("st_table_table_id_key", ConstraintId(1)); - m.insert("st_table_table_name_key", ConstraintId(2)); - m.insert("st_column_table_id_col_pos_key", ConstraintId(3)); - m.insert("st_sequence_sequence_id_key", ConstraintId(4)); - m.insert("st_index_index_id_key", ConstraintId(5)); - m.insert("st_constraint_constraint_id_key", ConstraintId(6)); - m.insert("st_client_identity_connection_id_key", ConstraintId(7)); - m.insert("st_var_name_key", ConstraintId(8)); - m.insert("st_scheduled_schedule_id_key", ConstraintId(9)); - m.insert("st_scheduled_table_id_key", ConstraintId(10)); - m.insert("st_row_level_security_sql_key", ConstraintId(11)); - m.insert("st_connection_credentials_connection_id_key", ConstraintId(12)); - m.insert("st_view_view_id_key", ConstraintId(13)); - m.insert("st_view_view_name_key", ConstraintId(14)); - m.insert("st_view_param_view_id_param_pos_key", ConstraintId(15)); - m.insert("st_view_column_view_id_col_pos_key", ConstraintId(16)); - m.insert("st_view_arg_id_key", ConstraintId(17)); - m.insert("st_view_arg_bytes_key", ConstraintId(18)); - m.insert("st_event_table_table_id_key", ConstraintId(19)); - m.insert("st_table_accessor_table_name_key", ConstraintId(20)); - m.insert("st_table_accessor_accessor_name_key", ConstraintId(21)); - m.insert("st_index_accessor_index_name_key", ConstraintId(22)); - m.insert("st_index_accessor_accessor_name_key", ConstraintId(23)); - m.insert("st_column_accessor_table_name_col_name_key", ConstraintId(24)); - m.insert("st_column_accessor_table_name_accessor_name_key", ConstraintId(25)); - m - }; -} - -lazy_static::lazy_static! { +pub static CONSTRAINT_IDS: LazyLock> = LazyLock::new(|| { + let mut m = HashMap::new(); + m.insert("st_table_table_id_key", ConstraintId(1)); + m.insert("st_table_table_name_key", ConstraintId(2)); + m.insert("st_column_table_id_col_pos_key", ConstraintId(3)); + m.insert("st_sequence_sequence_id_key", ConstraintId(4)); + m.insert("st_index_index_id_key", ConstraintId(5)); + m.insert("st_constraint_constraint_id_key", ConstraintId(6)); + m.insert("st_client_identity_connection_id_key", ConstraintId(7)); + m.insert("st_var_name_key", ConstraintId(8)); + m.insert("st_scheduled_schedule_id_key", ConstraintId(9)); + m.insert("st_scheduled_table_id_key", ConstraintId(10)); + m.insert("st_row_level_security_sql_key", ConstraintId(11)); + m.insert("st_connection_credentials_connection_id_key", ConstraintId(12)); + m.insert("st_view_view_id_key", ConstraintId(13)); + m.insert("st_view_view_name_key", ConstraintId(14)); + m.insert("st_view_param_view_id_param_pos_key", ConstraintId(15)); + m.insert("st_view_column_view_id_col_pos_key", ConstraintId(16)); + m.insert("st_view_arg_id_key", ConstraintId(17)); + m.insert("st_view_arg_bytes_key", ConstraintId(18)); + m.insert("st_event_table_table_id_key", ConstraintId(19)); + m.insert("st_table_accessor_table_name_key", ConstraintId(20)); + m.insert("st_table_accessor_accessor_name_key", ConstraintId(21)); + m.insert("st_index_accessor_index_name_key", ConstraintId(22)); + m.insert("st_index_accessor_accessor_name_key", ConstraintId(23)); + m.insert("st_column_accessor_table_name_col_name_key", ConstraintId(24)); + m.insert("st_column_accessor_table_name_accessor_name_key", ConstraintId(25)); + m +}); + // We enumerate the indexes used by system tables here, so that we can assign them stable IDs. // When adding a new index, we just need to make sure we are incrementing the last ID used. - pub static ref INDEX_IDS: HashMap<&'static str, IndexId> = { - let mut m = HashMap::new(); - m.insert("st_table_table_id_idx_btree", IndexId(1)); - m.insert("st_table_table_name_idx_btree", IndexId(2)); - m.insert("st_column_table_id_col_pos_idx_btree", IndexId(3)); - m.insert("st_sequence_sequence_id_idx_btree", IndexId(4)); - m.insert("st_index_index_id_idx_btree", IndexId(5)); - m.insert("st_constraint_constraint_id_idx_btree", IndexId(6)); - m.insert("st_client_identity_connection_id_idx_btree", IndexId(7)); - m.insert("st_var_name_idx_btree", IndexId(8)); - m.insert("st_scheduled_schedule_id_idx_btree", IndexId(9)); - m.insert("st_scheduled_table_id_idx_btree", IndexId(10)); - m.insert("st_row_level_security_table_id_idx_btree", IndexId(11)); - m.insert("st_row_level_security_sql_idx_btree", IndexId(12)); - m.insert("st_connection_credentials_connection_id_idx_btree", IndexId(13)); - m.insert("st_view_view_id_idx_btree", IndexId(14)); - m.insert("st_view_view_name_idx_btree", IndexId(15)); - m.insert("st_view_param_view_id_param_pos_idx_btree", IndexId(16)); - m.insert("st_view_column_view_id_col_pos_idx_btree", IndexId(17)); - m.insert("st_view_sub_identity_idx_btree", IndexId(18)); - m.insert("st_view_sub_has_subscribers_idx_btree", IndexId(19)); - m.insert("st_view_sub_view_id_arg_id_identity_idx_btree", IndexId(20)); - m.insert("st_view_arg_id_idx_btree", IndexId(21)); - m.insert("st_view_arg_bytes_idx_btree", IndexId(22)); - m.insert("st_event_table_table_id_idx_btree", IndexId(23)); - m.insert("st_table_accessor_table_name_idx_btree", IndexId(24)); - m.insert("st_table_accessor_accessor_name_idx_btree", IndexId(25)); - m.insert("st_index_accessor_index_name_idx_btree", IndexId(26)); - m.insert("st_index_accessor_accessor_name_idx_btree", IndexId(27)); - m.insert("st_column_accessor_table_name_col_name_idx_btree", IndexId(28)); - m.insert("st_column_accessor_table_name_accessor_name_idx_btree", IndexId(29)); - m - }; -} +pub static INDEX_IDS: LazyLock> = LazyLock::new(|| { + let mut m = HashMap::new(); + m.insert("st_table_table_id_idx_btree", IndexId(1)); + m.insert("st_table_table_name_idx_btree", IndexId(2)); + m.insert("st_column_table_id_col_pos_idx_btree", IndexId(3)); + m.insert("st_sequence_sequence_id_idx_btree", IndexId(4)); + m.insert("st_index_index_id_idx_btree", IndexId(5)); + m.insert("st_constraint_constraint_id_idx_btree", IndexId(6)); + m.insert("st_client_identity_connection_id_idx_btree", IndexId(7)); + m.insert("st_var_name_idx_btree", IndexId(8)); + m.insert("st_scheduled_schedule_id_idx_btree", IndexId(9)); + m.insert("st_scheduled_table_id_idx_btree", IndexId(10)); + m.insert("st_row_level_security_table_id_idx_btree", IndexId(11)); + m.insert("st_row_level_security_sql_idx_btree", IndexId(12)); + m.insert("st_connection_credentials_connection_id_idx_btree", IndexId(13)); + m.insert("st_view_view_id_idx_btree", IndexId(14)); + m.insert("st_view_view_name_idx_btree", IndexId(15)); + m.insert("st_view_param_view_id_param_pos_idx_btree", IndexId(16)); + m.insert("st_view_column_view_id_col_pos_idx_btree", IndexId(17)); + m.insert("st_view_sub_identity_idx_btree", IndexId(18)); + m.insert("st_view_sub_has_subscribers_idx_btree", IndexId(19)); + m.insert("st_view_sub_view_id_arg_id_identity_idx_btree", IndexId(20)); + m.insert("st_view_arg_id_idx_btree", IndexId(21)); + m.insert("st_view_arg_bytes_idx_btree", IndexId(22)); + m.insert("st_event_table_table_id_idx_btree", IndexId(23)); + m.insert("st_table_accessor_table_name_idx_btree", IndexId(24)); + m.insert("st_table_accessor_accessor_name_idx_btree", IndexId(25)); + m.insert("st_index_accessor_index_name_idx_btree", IndexId(26)); + m.insert("st_index_accessor_accessor_name_idx_btree", IndexId(27)); + m.insert("st_column_accessor_table_name_col_name_idx_btree", IndexId(28)); + m.insert("st_column_accessor_table_name_accessor_name_idx_btree", IndexId(29)); + m +}); // We enumerate of the sequences used by system tables here, so that we can assign them stable IDs. // When adding a new sequence, we just need to make sure we are incrementing the last ID used. -lazy_static::lazy_static! { - pub static ref SEQUENCE_IDS: HashMap<&'static str, SequenceId> = { - let mut m = HashMap::new(); - m.insert("st_table_table_id_seq", SequenceId(1)); - m.insert("st_index_index_id_seq", SequenceId(2)); - m.insert("st_constraint_constraint_id_seq", SequenceId(3)); - m.insert("st_scheduled_schedule_id_seq", SequenceId(4)); - m.insert("st_sequence_sequence_id_seq", SequenceId(5)); - m.insert("st_view_view_id_seq", SequenceId(6)); - m.insert("st_view_arg_id_seq", SequenceId(7)); - m - }; -} +pub static SEQUENCE_IDS: LazyLock> = LazyLock::new(|| { + let mut m = HashMap::new(); + m.insert("st_table_table_id_seq", SequenceId(1)); + m.insert("st_index_index_id_seq", SequenceId(2)); + m.insert("st_constraint_constraint_id_seq", SequenceId(3)); + m.insert("st_scheduled_schedule_id_seq", SequenceId(4)); + m.insert("st_sequence_sequence_id_seq", SequenceId(5)); + m.insert("st_view_view_id_seq", SequenceId(6)); + m.insert("st_view_arg_id_seq", SequenceId(7)); + m +}); fn st_schema(name: &str, id: TableId) -> TableSchema { let mut result = TableSchema::from_module_def( diff --git a/crates/schema/Cargo.toml b/crates/schema/Cargo.toml index 313e8dad38d..cbc7baccf92 100644 --- a/crates/schema/Cargo.toml +++ b/crates/schema/Cargo.toml @@ -21,7 +21,7 @@ anyhow.workspace = true derive_more.workspace = true indexmap.workspace = true itertools.workspace = true -lazy_static.workspace = true + lean_string.workspace = true thiserror.workspace = true unicode-ident.workspace = true diff --git a/crates/schema/src/identifier.rs b/crates/schema/src/identifier.rs index 06a396ec012..c74584dc9d3 100644 --- a/crates/schema/src/identifier.rs +++ b/crates/schema/src/identifier.rs @@ -4,13 +4,13 @@ use spacetimedb_sats::raw_identifier::RawIdentifier; use spacetimedb_sats::{impl_deserialize, impl_serialize, impl_st}; use std::fmt::{self, Debug, Display}; use std::ops::Deref; +use std::sync::LazyLock; use unicode_ident::{is_xid_continue, is_xid_start}; use unicode_normalization::UnicodeNormalization; -lazy_static::lazy_static! { - /// TODO(1.0): Pull in the rest of the reserved identifiers from the Identifier Proposal once that's merged. - static ref RESERVED_IDENTIFIERS: HashSet<&'static str> = include_str!("reserved_identifiers.txt").lines().collect(); -} +/// TODO(1.0): Pull in the rest of the reserved identifiers from the Identifier Proposal once that's merged. +static RESERVED_IDENTIFIERS: LazyLock> = + LazyLock::new(|| include_str!("reserved_identifiers.txt").lines().collect()); /// A valid SpacetimeDB Identifier. /// diff --git a/crates/testing/Cargo.toml b/crates/testing/Cargo.toml index bf8c305526d..7b8c46ac74c 100644 --- a/crates/testing/Cargo.toml +++ b/crates/testing/Cargo.toml @@ -28,7 +28,7 @@ serde_json.workspace = true tokio.workspace = true wasmbin.workspace = true duct.workspace = true -lazy_static.workspace = true + rand.workspace = true tempfile.workspace = true serde.workspace = true diff --git a/crates/testing/src/lib.rs b/crates/testing/src/lib.rs index 13cb9872b96..a5be4f32c53 100644 --- a/crates/testing/src/lib.rs +++ b/crates/testing/src/lib.rs @@ -5,19 +5,24 @@ use spacetimedb_paths::SpacetimePaths; use spacetimedb_schema::def::ModuleDef; use std::env; use std::process::Command; +use std::sync::LazyLock; pub mod modules; pub mod sdk; #[track_caller] pub fn invoke_cli(paths: &SpacetimePaths, args: &[&str]) { - lazy_static::lazy_static! { - static ref RUNTIME: tokio::runtime::Runtime = tokio::runtime::Builder::new_multi_thread() + static RUNTIME: LazyLock = LazyLock::new(|| { + tokio::runtime::Builder::new_multi_thread() .enable_all() .build() - .unwrap(); - static ref COMMAND: ClapCommand = ClapCommand::new("spacetime").no_binary_name(true).subcommands(spacetimedb_cli::get_subcommands()); - } + .unwrap() + }); + static COMMAND: LazyLock = LazyLock::new(|| { + ClapCommand::new("spacetime") + .no_binary_name(true) + .subcommands(spacetimedb_cli::get_subcommands()) + }); // Parse once so we can decide which path to use. let matches = COMMAND.clone().get_matches_from(args); diff --git a/crates/testing/src/modules.rs b/crates/testing/src/modules.rs index 318fff8d0cf..e83c71f0aa2 100644 --- a/crates/testing/src/modules.rs +++ b/crates/testing/src/modules.rs @@ -2,6 +2,7 @@ use std::env; use std::future::Future; use std::path::{Path, PathBuf}; use std::sync::Arc; +use std::sync::LazyLock; use std::sync::OnceLock; use std::time::Instant; @@ -302,9 +303,8 @@ impl ModuleLanguage for Csharp { const NAME: &'static str = "csharp"; fn get_module() -> &'static CompiledModule { - lazy_static::lazy_static! { - pub static ref MODULE: CompiledModule = CompiledModule::compile("benchmarks-cs", COMPILATION_MODE); - } + static MODULE: LazyLock = + LazyLock::new(|| CompiledModule::compile("benchmarks-cs", COMPILATION_MODE)); &MODULE } @@ -316,9 +316,8 @@ impl ModuleLanguage for Rust { const NAME: &'static str = "rust"; fn get_module() -> &'static CompiledModule { - lazy_static::lazy_static! { - pub static ref MODULE: CompiledModule = CompiledModule::compile("benchmarks", COMPILATION_MODE); - } + static MODULE: LazyLock = + LazyLock::new(|| CompiledModule::compile("benchmarks", COMPILATION_MODE)); &MODULE } @@ -330,9 +329,8 @@ impl ModuleLanguage for TypeScript { const NAME: &'static str = "typescript"; fn get_module() -> &'static CompiledModule { - lazy_static::lazy_static! { - pub static ref MODULE: CompiledModule = CompiledModule::compile("benchmarks-ts", COMPILATION_MODE); - } + static MODULE: LazyLock = + LazyLock::new(|| CompiledModule::compile("benchmarks-ts", COMPILATION_MODE)); &MODULE } @@ -344,9 +342,8 @@ impl ModuleLanguage for Cpp { const NAME: &'static str = "cpp"; fn get_module() -> &'static CompiledModule { - lazy_static::lazy_static! { - pub static ref MODULE: CompiledModule = CompiledModule::compile("benchmarks-cpp", COMPILATION_MODE); - } + static MODULE: LazyLock = + LazyLock::new(|| CompiledModule::compile("benchmarks-cpp", COMPILATION_MODE)); &MODULE }