other: fix non-applicable warning about regex creation in loop (#1661)

This commit is contained in:
Clement Tsang 2025-01-17 21:30:00 -05:00 committed by GitHub
parent c9ffc41e51
commit 873434b4b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -370,6 +370,11 @@ impl DataCollection {
// Must trim one level further for macOS!
static DISK_REGEX: OnceLock<Regex> = OnceLock::new();
#[expect(
clippy::regex_creation_in_loops,
reason = "this is fine since it's done via a static OnceLock. In the future though, separate it out."
)]
if let Some(new_name) = DISK_REGEX
.get_or_init(|| Regex::new(r"disk\d+").unwrap())
.find(checked_name)