mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Remove unnecessary use of static mut.
Atomic don't need to be `mut` to change since they use interior mutability.
This commit is contained in:
@@ -11,14 +11,14 @@
|
||||
use std::{ffi::CString, mem, os::fd::RawFd};
|
||||
|
||||
// Width of ambiguous characters. 1 is typical default.
|
||||
static mut FISH_AMBIGUOUS_WIDTH: AtomicI32 = AtomicI32::new(1);
|
||||
static FISH_AMBIGUOUS_WIDTH: AtomicI32 = AtomicI32::new(1);
|
||||
|
||||
// Width of emoji characters.
|
||||
// 1 is the typical emoji width in Unicode 8.
|
||||
static mut FISH_EMOJI_WIDTH: AtomicI32 = AtomicI32::new(1);
|
||||
static FISH_EMOJI_WIDTH: AtomicI32 = AtomicI32::new(1);
|
||||
|
||||
fn fish_get_emoji_width() -> i32 {
|
||||
unsafe { FISH_EMOJI_WIDTH.load(Ordering::Relaxed) }
|
||||
FISH_EMOJI_WIDTH.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
@@ -67,7 +67,7 @@ pub fn fish_wcwidth(c: char) -> i32 {
|
||||
}
|
||||
WcWidth::Ambiguous | WcWidth::PrivateUse => {
|
||||
// TR11: "All private-use characters are by default classified as Ambiguous".
|
||||
unsafe { FISH_AMBIGUOUS_WIDTH.load(Ordering::Relaxed) }
|
||||
FISH_AMBIGUOUS_WIDTH.load(Ordering::Relaxed)
|
||||
}
|
||||
WcWidth::One => 1,
|
||||
WcWidth::Two => 2,
|
||||
|
||||
Reference in New Issue
Block a user