Replace lazy_static with std::sync::LazyLock (#16066)

Closes #15860 

Since rust std now supports LazyLock replacing lazy_static with it
reduce the external dependency.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Sinan Gençoğlu
2024-08-20 14:27:33 -04:00
committed by GitHub
co-authored by Marshall Bowers
parent 85731dfe8e
commit ff7017c308
36 changed files with 160 additions and 195 deletions
+5 -4
View File
@@ -16,6 +16,7 @@ use settings::SettingsStore;
use std::{
env,
ops::Range,
sync::LazyLock,
time::{Duration, Instant},
};
use text::network::Network;
@@ -24,12 +25,12 @@ use text::{Point, ToPoint};
use unindent::Unindent as _;
use util::{assert_set_eq, post_inc, test::marked_text_ranges, RandomCharIter};
lazy_static! {
static ref TRAILING_WHITESPACE_REGEX: Regex = RegexBuilder::new("[ \t]+$")
pub static TRAILING_WHITESPACE_REGEX: LazyLock<regex::Regex> = LazyLock::new(|| {
RegexBuilder::new(r"[ \t]+$")
.multi_line(true)
.build()
.unwrap();
}
.expect("Failed to create TRAILING_WHITESPACE_REGEX")
});
#[cfg(test)]
#[ctor::ctor]