Skip to content

Commit

Permalink
Remove once_cell dependency preferring LazyLock (#195)
Browse files Browse the repository at this point in the history
`once_cell`'s features were stabilized and included in the standard
library under the std::sync module. We can use `LazyLock` to have the
same behaviour as `OnceCell::get_or_init`.
  • Loading branch information
Qkessler authored Dec 28, 2024
1 parent f08a5db commit 6e70ecc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion argh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ argh_derive.workspace = true
rust-fuzzy-search = "0.1.1"

[dev-dependencies]
once_cell = "1.10.0"
trybuild = "1.0.63"

[features]
Expand Down
8 changes: 4 additions & 4 deletions argh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
//! # use argh::DynamicSubCommand;
//! # use argh::EarlyExit;
//! # use argh::FromArgs;
//! # use once_cell::sync::OnceCell;
//! # use std::sync::LazyLock;
//!
//! #[derive(FromArgs, PartialEq, Debug)]
//! /// Top-level command.
Expand Down Expand Up @@ -240,8 +240,7 @@
//!
//! impl DynamicSubCommand for Dynamic {
//! fn commands() -> &'static [&'static CommandInfo] {
//! static RET: OnceCell<Vec<&'static CommandInfo>> = OnceCell::new();
//! RET.get_or_init(|| {
//! static RET: LazyLock<Vec<&'static CommandInfo>> = LazyLock::new(|| {
//! let mut commands = Vec::new();
//!
//! // argh needs the `CommandInfo` structs we generate to be valid
Expand All @@ -257,7 +256,8 @@
//! })));
//!
//! commands
//! })
//! });
//! &RET
//! }
//!
//! fn try_redact_arg_values(
Expand Down

0 comments on commit 6e70ecc

Please sign in to comment.