fix: clippy error in rust 1.84 and deny warnings in CI (#1178)

* fix: clippy error in 1.84

* fix: deny warnings

* fix: clippy warnings and doc errors

* fix: warnings

* fix: warnings

* fix: warnings

* fix: compile error
This commit is contained in:
Myriad-Dreamin 2025-01-15 20:26:34 +08:00 committed by GitHub
parent 31b22d9333
commit 448ce484d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 30 additions and 30 deletions

View file

@ -1,7 +1,7 @@
use core::fmt;
use std::borrow::Cow;
use std::str::FromStr;
use std::sync::{Arc, OnceLock};
use std::sync::{Arc, LazyLock};
use std::{
collections::{HashMap, HashSet},
ops::Range,
@ -397,6 +397,8 @@ fn pos(v: &Value) -> String {
impl Redact for RedactFields {
fn redact(&self, json_val: Value) -> Value {
static REG: LazyLock<regex::Regex> =
LazyLock::new(|| regex::Regex::new(r#"data:image/svg\+xml;base64,([^"]+)"#).unwrap());
match json_val {
Value::Object(mut map) => {
for (_, val) in map.iter_mut() {
@ -432,11 +434,7 @@ impl Redact for RedactFields {
}
"contents" => {
let res = t.as_str().unwrap();
static REG: OnceLock<regex::Regex> = OnceLock::new();
let reg = REG.get_or_init(|| {
regex::Regex::new(r#"data:image/svg\+xml;base64,([^"]+)"#).unwrap()
});
let res = reg.replace_all(res, |_captures: &regex::Captures| {
let res = REG.replace_all(res, |_captures: &regex::Captures| {
"data:image-hash/svg+xml;base64,redacted"
});