We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3933937 commit cba6568Copy full SHA for cba6568
core/src/xml.rs
@@ -1,7 +1,7 @@
1
use regress::Regex;
2
-use std::sync::OnceLock;
+use std::{ops::Deref, sync::LazyLock};
3
4
-static ENTITY_REGEX: OnceLock<Regex> = OnceLock::new();
+static ENTITY_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"&[^;]*;").unwrap());
5
6
/// Handles flash-specific XML unescaping behavior.
7
/// We accept all XML entities, and also accept standalone '&' without
@@ -12,7 +12,7 @@ pub fn custom_unescape(
12
) -> Result<String, quick_xml::Error> {
13
let input = decoder.decode(data)?;
14
15
- let re = ENTITY_REGEX.get_or_init(|| Regex::new(r"&[^;]*;").unwrap());
+ let re = ENTITY_REGEX.deref();
16
let mut result = String::new();
17
let mut last_end = 0;
18
0 commit comments