From 6446289f419390c13ee8ac2b464220c5a2bd6e97 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 17 Dec 2023 15:12:27 +0100 Subject: [PATCH] abbrs: fix naming convention --- fish-rust/src/abbrs.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fish-rust/src/abbrs.rs b/fish-rust/src/abbrs.rs index 611780665..6224b09b5 100644 --- a/fish-rust/src/abbrs.rs +++ b/fish-rust/src/abbrs.rs @@ -83,20 +83,20 @@ unsafe fn add<'a>( } } -static abbrs: Lazy> = Lazy::new(|| Mutex::new(Default::default())); +static ABBRS: Lazy> = Lazy::new(|| Mutex::new(Default::default())); pub fn with_abbrs(cb: impl FnOnce(&AbbreviationSet) -> R) -> R { - let abbrs_g = abbrs.lock().unwrap(); + let abbrs_g = ABBRS.lock().unwrap(); cb(&abbrs_g) } pub fn with_abbrs_mut(cb: impl FnOnce(&mut AbbreviationSet) -> R) -> R { - let mut abbrs_g = abbrs.lock().unwrap(); + let mut abbrs_g = ABBRS.lock().unwrap(); cb(&mut abbrs_g) } pub fn abbrs_get_set() -> MutexGuard<'static, AbbreviationSet> { - abbrs.lock().unwrap() + ABBRS.lock().unwrap() } /// Controls where in the command line abbreviations may expand. @@ -235,7 +235,7 @@ impl Replacement { /// Construct a replacement from a replacer. /// The \p range is the range of the text matched by the replacer in the command line. /// The text is passed in separately as it may be the output of the replacer's function. - fn from(range: SourceRange, mut text: WString, set_cursor_marker: Option) -> Self { + fn new(range: SourceRange, mut text: WString, set_cursor_marker: Option) -> Self { let mut cursor = None; if let Some(set_cursor_marker) = set_cursor_marker { let matched = text @@ -381,7 +381,7 @@ fn abbrs_list_ffi() -> Vec { } fn abbrs_get_set_ffi<'a>() -> Box> { - let abbrs_g = abbrs.lock().unwrap(); + let abbrs_g = ABBRS.lock().unwrap(); Box::new(GlobalAbbrs { g: abbrs_g }) } @@ -397,7 +397,7 @@ fn abbrs_replacement_from_ffi( None }; - let replacement = Replacement::from(range, text.from_ffi(), cursor_marker); + let replacement = Replacement::new(range, text.from_ffi(), cursor_marker); abbrs_replacement_t { range,