From 6c8409fd456fa9b318fbca72f05a36f3dc261793 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Tue, 2 May 2023 13:22:39 -0500 Subject: [PATCH] Remove unnecessary use of `static mut`. Atomic don't need to be `mut` to change since they use interior mutability. --- fish-rust/src/fallback.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fish-rust/src/fallback.rs b/fish-rust/src/fallback.rs index b3f6a232c..5a4be45ba 100644 --- a/fish-rust/src/fallback.rs +++ b/fish-rust/src/fallback.rs @@ -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,