Skip to content

Commit

Permalink
Place default sync rule static into function
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekkonot committed Nov 8, 2023
1 parent b980fb2 commit 8aa9011
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/snapshot_middleware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ use self::{

pub use self::{project::snapshot_project_node, util::emit_legacy_scripts_default};

static DEFAULT_SYNC_RULES: OnceLock<Vec<SyncRule>> = OnceLock::new();

/// Returns an `InstanceSnapshot` for the provided path.
/// This will inspect the path and find the appropriate middleware for it,
/// taking user-written rules into account. Then, it will attempt to convert
Expand Down Expand Up @@ -273,6 +271,8 @@ macro_rules! sync_rule {
/// These do not broadly overlap, but the order matters for some in the case of
/// e.g. JSON models.
fn default_sync_rules() -> &'static [SyncRule] {
static DEFAULT_SYNC_RULES: OnceLock<Vec<SyncRule>> = OnceLock::new();

DEFAULT_SYNC_RULES.get_or_init(|| {
vec![
sync_rule!("*.server.lua", ServerScript, ".server.lua"),
Expand Down

0 comments on commit 8aa9011

Please sign in to comment.