From 9d0c4a673036e48b4d8a455eb468806e9087fb4e Mon Sep 17 00:00:00 2001 From: romir kulshrestha Date: Wed, 4 Mar 2026 19:54:34 +0100 Subject: multiline usage --- oryxc/src/errors.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'oryxc/src/errors.rs') diff --git a/oryxc/src/errors.rs b/oryxc/src/errors.rs index 71ed741..4ad88d6 100644 --- a/oryxc/src/errors.rs +++ b/oryxc/src/errors.rs @@ -12,7 +12,10 @@ use std::fmt::{ }; use std::io::Write; use std::path::Path; -use std::sync::OnceLock; +use std::sync::{ + LazyLock, + OnceLock, +}; use std::{ env, io, @@ -36,12 +39,12 @@ pub enum ErrorStyle { pub static ERROR_STYLE: OnceLock = OnceLock::new(); pub fn progname() -> &'static OsString { - static ARGV0: OnceLock = OnceLock::new(); - return ARGV0.get_or_init(|| { + static ARGV0: LazyLock = LazyLock::new(|| { let default = OsStr::new("oryxc"); let s = env::args_os().next().unwrap_or(default.into()); - return Path::new(&s).file_name().unwrap_or(default).to_os_string(); + Path::new(&s).file_name().unwrap_or(default).to_os_string() }); + &ARGV0 } #[macro_export] -- cgit v1.2.3