chore: Remove dependency `once_cell`

Rust 1.80 introduced `std::sync::LazyLock` which achieves the same, so
cut down on dependencies a bit.

See: <https://doc.rust-lang.org/1.80.0/std/sync/struct.LazyLock.html>
This commit is contained in:
Lorenz Leutgeb 2025-06-09 12:06:30 +02:00
parent 3bc0db68f4
commit d50df68b74
23 changed files with 50 additions and 60 deletions

View File

@ -100,7 +100,7 @@ Imports are organized in groups, from least specific to more specific:
use std::time; use std::time;
use git_ref_format as format; // Then, external dependencies. use git_ref_format as format; // Then, external dependencies.
use once_cell::sync::Lazy; use serde_json::Value;
use crate::crypto::PublicKey; // Finally, local crate imports. use crate::crypto::PublicKey; // Finally, local crate imports.
use crate::storage::refs::Refs; use crate::storage::refs::Refs;

5
Cargo.lock generated
View File

@ -2598,7 +2598,6 @@ dependencies = [
"log", "log",
"multibase", "multibase",
"nonempty 0.9.0", "nonempty 0.9.0",
"once_cell",
"pretty_assertions", "pretty_assertions",
"qcheck", "qcheck",
"qcheck-macros", "qcheck-macros",
@ -2681,7 +2680,6 @@ dependencies = [
"git2", "git2",
"log", "log",
"nonempty 0.9.0", "nonempty 0.9.0",
"once_cell",
"qcheck", "qcheck",
"qcheck-macros", "qcheck-macros",
"radicle-crypto", "radicle-crypto",
@ -2790,7 +2788,6 @@ dependencies = [
"log", "log",
"netservices", "netservices",
"nonempty 0.9.0", "nonempty 0.9.0",
"once_cell",
"qcheck", "qcheck",
"qcheck-macros", "qcheck-macros",
"radicle", "radicle",
@ -2825,7 +2822,6 @@ dependencies = [
name = "radicle-schemars" name = "radicle-schemars"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"once_cell",
"radicle", "radicle",
"schemars", "schemars",
"serde", "serde",
@ -2890,7 +2886,6 @@ dependencies = [
"git2", "git2",
"inquire", "inquire",
"libc", "libc",
"once_cell",
"pretty_assertions", "pretty_assertions",
"radicle-signals", "radicle-signals",
"shlex", "shlex",

View File

@ -22,7 +22,6 @@ stable-commit-ids = []
fastrand = { version = "2.0.0" } fastrand = { version = "2.0.0" }
log = { version = "0.4.17" } log = { version = "0.4.17" }
nonempty = { version = "0.9.0", features = ["serialize"] } nonempty = { version = "0.9.0", features = ["serialize"] }
once_cell = { version = "1.13" }
radicle-git-ext = { version = "0.8.0", features = ["serde"] } radicle-git-ext = { version = "0.8.0", features = ["serde"] }
serde_json = { version = "1.0" } serde_json = { version = "1.0" }
signature = { version = "2.2" } signature = { version = "2.2" }

View File

@ -3,12 +3,12 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::convert::TryFrom; use std::convert::TryFrom;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::LazyLock;
use git_ext::author::Author; use git_ext::author::Author;
use git_ext::commit::{headers::Headers, Commit}; use git_ext::commit::{headers::Headers, Commit};
use git_ext::Oid; use git_ext::Oid;
use nonempty::NonEmpty; use nonempty::NonEmpty;
use once_cell::sync::Lazy;
use radicle_git_ext::commit::trailers::OwnedTrailer; use radicle_git_ext::commit::trailers::OwnedTrailer;
use crate::change::store::Version; use crate::change::store::Version;
@ -24,7 +24,7 @@ use crate::{
/// Name of the COB manifest file. /// Name of the COB manifest file.
pub const MANIFEST_BLOB_NAME: &str = "manifest"; pub const MANIFEST_BLOB_NAME: &str = "manifest";
/// Path under which COB embeds are kept. /// Path under which COB embeds are kept.
pub static EMBEDS_PATH: Lazy<PathBuf> = Lazy::new(|| PathBuf::from("embeds")); pub static EMBEDS_PATH: LazyLock<PathBuf> = LazyLock::new(|| PathBuf::from("embeds"));
pub mod error { pub mod error {
use std::str::Utf8Error; use std::str::Utf8Error;

View File

@ -31,7 +31,6 @@ log = { version = "0.4.17", features = ["std"] }
localtime = { version = "1.2.0" } localtime = { version = "1.2.0" }
netservices = { version = "0.8.0", features = ["io-reactor", "socket2"] } netservices = { version = "0.8.0", features = ["io-reactor", "socket2"] }
nonempty = { version = "0.9.0", features = ["serialize"] } nonempty = { version = "0.9.0", features = ["serialize"] }
once_cell = { version = "1.13" }
qcheck = { version = "1", default-features = false, optional = true } qcheck = { version = "1", default-features = false, optional = true }
# N.b. this is required to use macros, even though it's re-exported # N.b. this is required to use macros, even though it's re-exported
# through radicle # through radicle

View File

@ -1,16 +1,16 @@
pub mod store; pub mod store;
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use super::*; use super::*;
use crate::{PROTOCOL_VERSION, VERSION}; use crate::{PROTOCOL_VERSION, VERSION};
use once_cell::sync::Lazy;
use radicle::node::UserAgent; use radicle::node::UserAgent;
pub use store::{AnnouncementId, Error, RelayStatus, Store}; pub use store::{AnnouncementId, Error, RelayStatus, Store};
/// This node's user agent string. /// This node's user agent string.
pub static USER_AGENT: Lazy<UserAgent> = Lazy::new(|| { pub static USER_AGENT: LazyLock<UserAgent> = LazyLock::new(|| {
FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str()) FromStr::from_str(format!("/radicle:{}/", VERSION.version).as_str())
.expect("user agent is valid") .expect("user agent is valid")
}); });

View File

@ -5,11 +5,11 @@ use std::default::*;
use std::env; use std::env;
use std::io; use std::io;
use std::sync::Arc; use std::sync::Arc;
use std::sync::LazyLock;
use std::time; use std::time;
use crossbeam_channel as chan; use crossbeam_channel as chan;
use netservices::Direction as Link; use netservices::Direction as Link;
use once_cell::sync::Lazy;
use radicle::identity::Visibility; use radicle::identity::Visibility;
use radicle::node::address::Store as _; use radicle::node::address::Store as _;
use radicle::node::device::Device; use radicle::node::device::Device;
@ -57,7 +57,7 @@ use crate::{git, identity, rad, runtime, service, test};
/// Default number of tests to run when testing things with high variance. /// Default number of tests to run when testing things with high variance.
pub const DEFAULT_TEST_CASES: usize = 10; pub const DEFAULT_TEST_CASES: usize = 10;
/// Test cases to run when testing things with high variance. /// Test cases to run when testing things with high variance.
pub static TEST_CASES: Lazy<usize> = Lazy::new(|| { pub static TEST_CASES: LazyLock<usize> = LazyLock::new(|| {
env::var("RAD_TEST_CASES") env::var("RAD_TEST_CASES")
.ok() .ok()
.and_then(|s| s.parse::<usize>().ok()) .and_then(|s| s.parse::<usize>().ok())

View File

@ -13,7 +13,6 @@ name = "radicle-schemars"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
once_cell = { version = "1.13" }
schemars = { workspace = true } schemars = { workspace = true }
serde = { version = "1.0" } serde = { version = "1.0" }
serde_json = { version = "1" } serde_json = { version = "1" }

View File

@ -1,7 +1,7 @@
use std::io; use std::io;
use std::net; use std::net;
use std::sync::LazyLock;
use once_cell::sync::Lazy;
use schemars::{generate::*, *}; use schemars::{generate::*, *};
const SCHEMA_COMMAND: &str = "radicle::node::Command"; const SCHEMA_COMMAND: &str = "radicle::node::Command";
@ -10,7 +10,7 @@ const SCHEMA_PROFILE_CONFIG: &str = "radicle::profile::Config";
const SCHEMAS: &[&str] = &[SCHEMA_COMMAND, SCHEMA_COMMAND_RESULT, SCHEMA_PROFILE_CONFIG]; const SCHEMAS: &[&str] = &[SCHEMA_COMMAND, SCHEMA_COMMAND_RESULT, SCHEMA_PROFILE_CONFIG];
pub static ERROR_MSG: Lazy<String> = Lazy::new(|| { pub static ERROR_MSG: LazyLock<String> = LazyLock::new(|| {
let schemas = SCHEMAS.to_vec().join("\", \""); let schemas = SCHEMAS.to_vec().join("\", \"");
format!("Expected exactly one of the following schema names: [\"{schemas}\"].") format!("Expected exactly one of the following schema names: [\"{schemas}\"].")
}); });

View File

@ -18,7 +18,6 @@ anstyle-query = { version = "1.0.0" }
crossbeam-channel = { version = "0.5.6" } crossbeam-channel = { version = "0.5.6" }
inquire = { version = "0.7.4", default-features = false, features = ["termion", "editor"] } inquire = { version = "0.7.4", default-features = false, features = ["termion", "editor"] }
libc = { version = "0.2" } libc = { version = "0.2" }
once_cell = { version = "1.13" }
shlex = { version = "1.1" } shlex = { version = "1.1" }
termion = { version = "3" } termion = { version = "3" }
thiserror = { version = "1" } thiserror = { version = "1" }

View File

@ -1,10 +1,9 @@
use std::io::IsTerminal as _; use std::io::IsTerminal as _;
use std::os::fd::{AsRawFd, BorrowedFd}; use std::os::fd::{AsRawFd, BorrowedFd};
use std::sync::atomic::{AtomicBool, AtomicI32}; use std::sync::atomic::{AtomicBool, AtomicI32};
use std::sync::LazyLock;
use std::{fmt, sync}; use std::{fmt, sync};
use once_cell::sync::Lazy;
use super::color::Color; use super::color::Color;
use super::style::{Property, Style}; use super::style::{Property, Style};
@ -277,7 +276,7 @@ impl Paint<()> {
/// Check 24-bit RGB color support. /// Check 24-bit RGB color support.
pub fn truecolor() -> bool { pub fn truecolor() -> bool {
static TRUECOLOR: Lazy<bool> = Lazy::new(anstyle_query::term_supports_color); static TRUECOLOR: LazyLock<bool> = LazyLock::new(anstyle_query::term_supports_color);
*TRUECOLOR *TRUECOLOR
} }

View File

@ -1,13 +1,13 @@
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fmt::Write; use std::fmt::Write;
use std::process::Stdio; use std::process::Stdio;
use std::sync::LazyLock;
use std::{env, fmt, io, process}; use std::{env, fmt, io, process};
use inquire::ui::{ErrorMessageRenderConfig, StyleSheet, Styled}; use inquire::ui::{ErrorMessageRenderConfig, StyleSheet, Styled};
use inquire::validator; use inquire::validator;
use inquire::InquireError; use inquire::InquireError;
use inquire::{ui::Color, ui::RenderConfig, Confirm, CustomType, Password}; use inquire::{ui::Color, ui::RenderConfig, Confirm, CustomType, Password};
use once_cell::sync::Lazy;
use zeroize::Zeroizing; use zeroize::Zeroizing;
use crate::command; use crate::command;
@ -26,7 +26,7 @@ pub const TAB: &str = " ";
pub type Passphrase = Zeroizing<String>; pub type Passphrase = Zeroizing<String>;
/// Render configuration. /// Render configuration.
pub static CONFIG: Lazy<RenderConfig> = Lazy::new(|| RenderConfig { pub static CONFIG: LazyLock<RenderConfig> = LazyLock::new(|| RenderConfig {
prompt: StyleSheet::new().with_fg(Color::LightCyan), prompt: StyleSheet::new().with_fg(Color::LightCyan),
prompt_prefix: Styled::new("?").with_fg(Color::LightBlue), prompt_prefix: Styled::new("?").with_fg(Color::LightBlue),
answered_prompt_prefix: Styled::new("").with_fg(Color::LightGreen), answered_prompt_prefix: Styled::new("").with_fg(Color::LightGreen),

View File

@ -26,7 +26,6 @@ localtime = { version = "1.2.0", features = ["serde"] }
libc = { version = "0.2" } libc = { version = "0.2" }
log = { version = "0.4.17", features = ["std"] } log = { version = "0.4.17", features = ["std"] }
nonempty = { version = "0.9.0", features = ["serialize"] } nonempty = { version = "0.9.0", features = ["serialize"] }
once_cell = { version = "1.13" }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["preserve_order"] } serde_json = { version = "1", features = ["preserve_order"] }
siphasher = { version = "1.0.0" } siphasher = { version = "1.0.0" }

View File

@ -1,8 +1,8 @@
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::sync::LazyLock;
use std::{fmt, ops::Deref, str::FromStr}; use std::{fmt, ops::Deref, str::FromStr};
use crypto::{PublicKey, Signature}; use crypto::{PublicKey, Signature};
use once_cell::sync::Lazy;
use radicle_cob::{Embed, ObjectId, TypeName}; use radicle_cob::{Embed, ObjectId, TypeName};
use radicle_git_ext as git_ext; use radicle_git_ext as git_ext;
use radicle_git_ext::Oid; use radicle_git_ext::Oid;
@ -29,8 +29,8 @@ use crate::{
use super::{Author, EntryId}; use super::{Author, EntryId};
/// Type name of an identity proposal. /// Type name of an identity proposal.
pub static TYPENAME: Lazy<TypeName> = pub static TYPENAME: LazyLock<TypeName> =
Lazy::new(|| FromStr::from_str("xyz.radicle.id").expect("type name is valid")); LazyLock::new(|| FromStr::from_str("xyz.radicle.id").expect("type name is valid"));
/// Identity operation. /// Identity operation.
pub type Op = cob::Op<Action>; pub type Op = cob::Op<Action>;

View File

@ -3,8 +3,8 @@ pub mod cache;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::ops::Deref; use std::ops::Deref;
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use thiserror::Error; use thiserror::Error;
@ -27,8 +27,8 @@ pub use cache::Cache;
pub type Op = cob::Op<Action>; pub type Op = cob::Op<Action>;
/// Type name of an issue. /// Type name of an issue.
pub static TYPENAME: Lazy<TypeName> = pub static TYPENAME: LazyLock<TypeName> =
Lazy::new(|| FromStr::from_str("xyz.radicle.issue").expect("type name is valid")); LazyLock::new(|| FromStr::from_str("xyz.radicle.issue").expect("type name is valid"));
/// Identifier for an issue. /// Identifier for an issue.
pub type IssueId = ObjectId; pub type IssueId = ObjectId;

View File

@ -5,10 +5,10 @@ use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::fmt; use std::fmt;
use std::ops::Deref; use std::ops::Deref;
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use amplify::Wrapper; use amplify::Wrapper;
use nonempty::NonEmpty; use nonempty::NonEmpty;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use storage::{HasRepoId, RepositoryError}; use storage::{HasRepoId, RepositoryError};
use thiserror::Error; use thiserror::Error;
@ -32,8 +32,8 @@ use crate::storage;
pub use cache::Cache; pub use cache::Cache;
/// Type name of a patch. /// Type name of a patch.
pub static TYPENAME: Lazy<TypeName> = pub static TYPENAME: LazyLock<TypeName> =
Lazy::new(|| FromStr::from_str("xyz.radicle.patch").expect("type name is valid")); LazyLock::new(|| FromStr::from_str("xyz.radicle.patch").expect("type name is valid"));
/// Patch operation. /// Patch operation.
pub type Op = cob::Op<Action>; pub type Op = cob::Op<Action>;

View File

@ -1,8 +1,8 @@
use std::cmp::Ordering; use std::cmp::Ordering;
use std::collections::{BTreeMap, BTreeSet}; use std::collections::{BTreeMap, BTreeSet};
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use once_cell::sync::Lazy;
use serde::{ser::SerializeStruct, Deserialize, Serialize}; use serde::{ser::SerializeStruct, Deserialize, Serialize};
use thiserror::Error; use thiserror::Error;
@ -15,8 +15,8 @@ use crate::prelude::ReadRepository;
/// Type name of a thread, as well as the domain for all thread operations. /// Type name of a thread, as well as the domain for all thread operations.
/// Note that threads are not usually used standalone. They are embeded into other COBs. /// Note that threads are not usually used standalone. They are embeded into other COBs.
pub static TYPENAME: Lazy<cob::TypeName> = pub static TYPENAME: LazyLock<cob::TypeName> =
Lazy::new(|| FromStr::from_str("xyz.radicle.thread").expect("type name is valid")); LazyLock::new(|| FromStr::from_str("xyz.radicle.thread").expect("type name is valid"));
/// Error applying an operation onto a state. /// Error applying an operation onto a state.
#[derive(Error, Debug)] #[derive(Error, Debug)]

View File

@ -4,9 +4,9 @@ use std::io;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use git_ext::ref_format as format; use git_ext::ref_format as format;
use once_cell::sync::Lazy;
use crate::collections::RandomMap; use crate::collections::RandomMap;
use crate::crypto::PublicKey; use crate::crypto::PublicKey;
@ -188,7 +188,7 @@ pub mod refs {
/// ///
/// `refs/rad/id` /// `refs/rad/id`
/// ///
pub static IDENTITY_BRANCH: Lazy<Qualified> = Lazy::new(|| { pub static IDENTITY_BRANCH: LazyLock<Qualified> = LazyLock::new(|| {
Qualified::from_components(name::component!("rad"), name::component!("id"), None) Qualified::from_components(name::component!("rad"), name::component!("id"), None)
}); });
@ -196,7 +196,7 @@ pub mod refs {
/// ///
/// `refs/rad/root` /// `refs/rad/root`
/// ///
pub static IDENTITY_ROOT: Lazy<Qualified> = Lazy::new(|| { pub static IDENTITY_ROOT: LazyLock<Qualified> = LazyLock::new(|| {
Qualified::from_components(name::component!("rad"), name::component!("root"), None) Qualified::from_components(name::component!("rad"), name::component!("root"), None)
}); });
@ -204,7 +204,7 @@ pub mod refs {
/// ///
/// `refs/rad/sigrefs` /// `refs/rad/sigrefs`
/// ///
pub static SIGREFS_BRANCH: Lazy<Qualified> = Lazy::new(|| { pub static SIGREFS_BRANCH: LazyLock<Qualified> = LazyLock::new(|| {
Qualified::from_components(name::component!("rad"), name::component!("sigrefs"), None) Qualified::from_components(name::component!("rad"), name::component!("sigrefs"), None)
}); });

View File

@ -6,9 +6,9 @@ use std::num::{NonZeroU32, NonZeroUsize};
use std::ops::{Deref, Not}; use std::ops::{Deref, Not};
use std::path::Path; use std::path::Path;
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use nonempty::NonEmpty; use nonempty::NonEmpty;
use once_cell::sync::Lazy;
use radicle_cob::type_name::{TypeName, TypeNameParse}; use radicle_cob::type_name::{TypeName, TypeNameParse};
use radicle_git_ext::Oid; use radicle_git_ext::Oid;
use serde::{de, Deserialize, Serialize}; use serde::{de, Deserialize, Serialize};
@ -28,7 +28,7 @@ pub use crypto::PublicKey;
pub use id::*; pub use id::*;
/// Path to the identity document in the identity branch. /// Path to the identity document in the identity branch.
pub static PATH: Lazy<&Path> = Lazy::new(|| Path::new("radicle.json")); pub static PATH: LazyLock<&Path> = LazyLock::new(|| Path::new("radicle.json"));
/// Maximum length of a string in the identity document. /// Maximum length of a string in the identity document.
pub const MAX_STRING_LENGTH: usize = 255; pub const MAX_STRING_LENGTH: usize = 255;
/// Maximum number of a delegates in the identity document. /// Maximum number of a delegates in the identity document.

View File

@ -23,10 +23,10 @@ pub mod seeds {
use std::str::FromStr; use std::str::FromStr;
use super::{ConnectAddress, PeerAddr}; use super::{ConnectAddress, PeerAddr};
use once_cell::sync::Lazy; use std::sync::LazyLock;
/// A public Radicle seed node for the community. /// A public Radicle seed node for the community.
pub static RADICLE_NODE_BOOTSTRAP_IRIS: Lazy<ConnectAddress> = Lazy::new(|| { pub static RADICLE_NODE_BOOTSTRAP_IRIS: LazyLock<ConnectAddress> = LazyLock::new(|| {
// SAFETY: `ConnectAddress` is known at compile time. // SAFETY: `ConnectAddress` is known at compile time.
#[allow(clippy::unwrap_used)] #[allow(clippy::unwrap_used)]
PeerAddr::from_str("z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776") PeerAddr::from_str("z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776")
@ -35,7 +35,7 @@ pub mod seeds {
}); });
/// A public Radicle seed node for the community. /// A public Radicle seed node for the community.
pub static RADICLE_NODE_BOOTSTRAP_ROSA: Lazy<ConnectAddress> = Lazy::new(|| { pub static RADICLE_NODE_BOOTSTRAP_ROSA: LazyLock<ConnectAddress> = LazyLock::new(|| {
// SAFETY: `ConnectAddress` is known at compile time. // SAFETY: `ConnectAddress` is known at compile time.
#[allow(clippy::unwrap_used)] #[allow(clippy::unwrap_used)]
PeerAddr::from_str("z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@rosa.radicle.xyz:8776") PeerAddr::from_str("z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@rosa.radicle.xyz:8776")
@ -44,7 +44,7 @@ pub mod seeds {
}); });
/// The Radicle seed node that the Radicle team uses. /// The Radicle seed node that the Radicle team uses.
pub static RADICLE_NODE_TEAM: Lazy<ConnectAddress> = Lazy::new(|| { pub static RADICLE_NODE_TEAM: LazyLock<ConnectAddress> = LazyLock::new(|| {
// SAFETY: `ConnectAddress` is known at compile time. // SAFETY: `ConnectAddress` is known at compile time.
#[allow(clippy::unwrap_used)] #[allow(clippy::unwrap_used)]
PeerAddr::from_str("z6MksmpU5b1dS7oaqF2bHXhQi1DWy2hB7Mh9CuN7y1DN6QSz@seed.radicle.xyz:8776") PeerAddr::from_str("z6MksmpU5b1dS7oaqF2bHXhQi1DWy2hB7Mh9CuN7y1DN6QSz@seed.radicle.xyz:8776")

View File

@ -2,8 +2,8 @@
use std::io; use std::io;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use once_cell::sync::Lazy;
use thiserror::Error; use thiserror::Error;
use crate::cob::ObjectId; use crate::cob::ObjectId;
@ -22,11 +22,13 @@ use crate::storage::{WriteRepository, WriteStorage};
use crate::{identity, storage}; use crate::{identity, storage};
/// Name of the radicle storage remote. /// Name of the radicle storage remote.
pub static REMOTE_NAME: Lazy<git::RefString> = Lazy::new(|| git::refname!("rad")); pub static REMOTE_NAME: LazyLock<git::RefString> = LazyLock::new(|| git::refname!("rad"));
/// Name of the radicle storage remote. /// Name of the radicle storage remote.
pub static REMOTE_COMPONENT: Lazy<git::Component> = Lazy::new(|| git::fmt::name::component!("rad")); pub static REMOTE_COMPONENT: LazyLock<git::Component> =
LazyLock::new(|| git::fmt::name::component!("rad"));
/// Refname used for pushing patches. /// Refname used for pushing patches.
pub static PATCHES_REFNAME: Lazy<git::RefString> = Lazy::new(|| git::refname!("refs/patches")); pub static PATCHES_REFNAME: LazyLock<git::RefString> =
LazyLock::new(|| git::refname!("refs/patches"));
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum InitError { pub enum InitError {

View File

@ -5,10 +5,10 @@ pub mod transport;
use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::LazyLock;
use std::{fs, io}; use std::{fs, io};
use crypto::Verified; use crypto::Verified;
use once_cell::sync::Lazy;
use tempfile::TempDir; use tempfile::TempDir;
use crate::git::canonical::Canonical; use crate::git::canonical::Canonical;
@ -33,11 +33,11 @@ pub use crate::storage::{Error, RepositoryError};
use super::refs::RefsAt; use super::refs::RefsAt;
use super::{RemoteId, RemoteRepository, ValidateRepository}; use super::{RemoteId, RemoteRepository, ValidateRepository};
pub static NAMESPACES_GLOB: Lazy<git::refspec::PatternString> = pub static NAMESPACES_GLOB: LazyLock<git::refspec::PatternString> =
Lazy::new(|| git::refspec::pattern!("refs/namespaces/*")); LazyLock::new(|| git::refspec::pattern!("refs/namespaces/*"));
pub static SIGREFS_GLOB: Lazy<refspec::PatternString> = pub static SIGREFS_GLOB: LazyLock<refspec::PatternString> =
Lazy::new(|| git::refspec::pattern!("refs/namespaces/*/rad/sigrefs")); LazyLock::new(|| git::refspec::pattern!("refs/namespaces/*/rad/sigrefs"));
pub static CANONICAL_IDENTITY: Lazy<git::Qualified> = Lazy::new(|| { pub static CANONICAL_IDENTITY: LazyLock<git::Qualified> = LazyLock::new(|| {
git::Qualified::from_components( git::Qualified::from_components(
git::name::component!("rad"), git::name::component!("rad"),
git::name::component!("id"), git::name::component!("id"),

View File

@ -2,19 +2,18 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::sync::LazyLock;
use std::sync::{Mutex, Once}; use std::sync::{Mutex, Once};
use std::thread::ThreadId; use std::thread::ThreadId;
use std::{process, thread}; use std::{process, thread};
use once_cell::sync::Lazy;
use super::Url; use super::Url;
use crate::storage::git::transport::ChildStream; use crate::storage::git::transport::ChildStream;
use crate::storage::RemoteId; use crate::storage::RemoteId;
/// Nodes registered with the mock transport. /// Nodes registered with the mock transport.
static NODES: Lazy<Mutex<HashMap<(ThreadId, RemoteId), PathBuf>>> = static NODES: LazyLock<Mutex<HashMap<(ThreadId, RemoteId), PathBuf>>> =
Lazy::new(|| Mutex::new(HashMap::new())); LazyLock::new(|| Mutex::new(HashMap::new()));
/// The mock transport. /// The mock transport.
#[derive(Default)] #[derive(Default)]