diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-14 18:24:38 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-14 18:24:38 +0800 |
| commit | 8c46a255f9987f06fb4f60d9c576d8694dbc80d5 (patch) | |
| tree | b82f1067562baa3b8aea23face886ce6b793bdf5 | |
| parent | e66b1335a22df2a9f9555e59e30200644bb3483f (diff) | |
feat(style): fall back to UNIX_STYLE when global style unset
| -rw-r--r-- | mingling_picker/src/parselib/style.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mingling_picker/src/parselib/style.rs b/mingling_picker/src/parselib/style.rs index c0eb58f..770ef05 100644 --- a/mingling_picker/src/parselib/style.rs +++ b/mingling_picker/src/parselib/style.rs @@ -75,12 +75,8 @@ impl<'a> ParserStyle<'a> { } } - /// Returns the global parser style, or `None` if not yet set. - pub fn global_style() -> Option<&'static ParserStyle<'static>> { - if GLOBAL_STYLE_SET.load(Ordering::Acquire) { - GLOBAL_STYLE.get() - } else { - None - } + /// Returns the global parser style, falling back to `UNIX_STYLE` if not set. + pub fn global_style() -> &'static ParserStyle<'static> { + GLOBAL_STYLE.get().unwrap_or(&UNIX_STYLE) } } |
