summaryrefslogtreecommitdiff
path: root/oryxc/src/errors.rs
diff options
context:
space:
mode:
authorromir kulshrestha <romir.kulshrestha@gmail.com> 2026-03-04 19:54:34 +0100
committerromir kulshrestha <romir.kulshrestha@gmail.com> 2026-03-04 19:54:34 +0100
commit9d0c4a673036e48b4d8a455eb468806e9087fb4e (patch)
tree8301ed4dca9001fe423889626920ce661cfbe774 /oryxc/src/errors.rs
parentcb792e04c739aa0ea1e957595508b5d2b42fe1c2 (diff)
multiline usage
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]