summaryrefslogtreecommitdiff
path: root/oryxc/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'oryxc/src/errors.rs')
-rw-r--r--oryxc/src/errors.rs11
1 files changed, 7 insertions, 4 deletions
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<ErrorStyle> = OnceLock::new();
pub fn progname() -> &'static OsString {
- static ARGV0: OnceLock<OsString> = OnceLock::new();
- return ARGV0.get_or_init(|| {
+ static ARGV0: LazyLock<OsString> = 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]