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 20:27:33 +02:00 committed by GitHub
parent 85731dfe8e
commit ff7017c308
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 160 additions and 195 deletions

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]