refactor(tvix/glue): remove use of lazy_static

This is now supported in the standard library via std::sync::LazyLock, but
requires some manual shuffling around of code.

Change-Id: Ibb3be8458b8a8912ea04c9360d64c5cf914254d4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12609
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2024-10-13 13:30:52 +03:00 committed by clbot
parent 5faf7c9d7b
commit 4beee4cba7
6 changed files with 61 additions and 47 deletions

View file

@ -213,6 +213,7 @@ mod test {
use bytes::Bytes;
use nix_compat::derivation::Derivation;
use std::collections::BTreeMap;
use std::sync::LazyLock;
use tvix_build::proto::{
build_request::{AdditionalFile, BuildConstraints, EnvVar},
BuildRequest,
@ -223,15 +224,14 @@ mod test {
use crate::tvix_build::NIX_ENVIRONMENT_VARS;
use super::derivation_to_build_request;
use lazy_static::lazy_static;
lazy_static! {
static ref INPUT_NODE_FOO_NAME: Bytes = "mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar".into();
static ref INPUT_NODE_FOO: Node = Node::Directory {
digest: DUMMY_DIGEST.clone(),
size: 42
};
}
static INPUT_NODE_FOO_NAME: LazyLock<Bytes> =
LazyLock::new(|| "mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar".into());
static INPUT_NODE_FOO: LazyLock<Node> = LazyLock::new(|| Node::Directory {
digest: DUMMY_DIGEST.clone(),
size: 42,
});
#[test]
fn test_derivation_to_build_request() {