From cbacb72fff7437105440be1a5aa967e20b1ea26e Mon Sep 17 00:00:00 2001 From: Griffin Berlstein Date: Mon, 6 Jan 2025 11:55:50 -0500 Subject: [PATCH] replace `OnceLock` with `LazyLock` --- cider/src/debugger/commands/core.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cider/src/debugger/commands/core.rs b/cider/src/debugger/commands/core.rs index f9267c5a1..48eba4734 100644 --- a/cider/src/debugger/commands/core.rs +++ b/cider/src/debugger/commands/core.rs @@ -439,16 +439,11 @@ impl Command { // I wouldn't recommend looking at this -use std::sync::OnceLock; +use std::sync::LazyLock; /// A (lazy) static list of [CommandInfo] objects used for the help and /// explain messages. Access via [get_command_info] -static COMMAND_INFO: OnceLock> = OnceLock::new(); - -/// Returns the list of [CommandInfo] objects used for the help and explain -/// messages -fn get_command_info() -> &'static [CommandInfo] { - COMMAND_INFO.get_or_init(|| { - [ +static COMMAND_INFO: LazyLock> = LazyLock::new(|| { + [ // step CIBuilder::new().invocation("step") .invocation("s") @@ -538,7 +533,13 @@ fn get_command_info() -> &'static [CommandInfo] { .invocation("quit") .description("Exit the debugger").build(), ].into() - }) +}); + +/// Returns the list of [CommandInfo] objects used for the help and explain +/// messages +#[inline] +fn get_command_info() -> &'static [CommandInfo] { + &COMMAND_INFO } #[derive(Clone, Debug)]