From 9e9550885fe666c95dda05fdd47ef8d5d23ddc0c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 3 Oct 2023 16:28:35 -0700 Subject: [PATCH] replace regex with lazy-regex macros --- Cargo.lock | 25 ++++++++++++++++++++++++- Cargo.toml | 2 +- src/load_roblox.rs | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d964dc80..2a3a1579 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -834,6 +834,29 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "lazy-regex" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e723bd417b2df60a0f6a2b6825f297ea04b245d4ba52b5a22cb679bdf58b05fa" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0a1d9139f0ee2e862e08a9c5d0ba0470f2aa21cd1e1aa1b1562f83116c725f" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.29", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1666,6 +1689,7 @@ dependencies = [ "ddsfile", "env_logger", "glam", + "lazy-regex", "log", "obj", "pollster", @@ -1673,7 +1697,6 @@ dependencies = [ "rbx_dom_weak", "rbx_reflection_database", "rbx_xml", - "regex", "wgpu", "winit", ] diff --git a/Cargo.toml b/Cargo.toml index 961c5f9a..5138640a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ bytemuck = { version = "1.13.1", features = ["derive"] } ddsfile = "0.5.1" env_logger = "0.10.0" glam = "0.24.1" +lazy-regex = "3.0.2" log = "0.4.20" obj = "0.10.2" pollster = "0.3.0" @@ -18,7 +19,6 @@ rbx_binary = "0.7.1" rbx_dom_weak = "2.5.0" rbx_reflection_database = "0.2.7" rbx_xml = "0.13.1" -regex = "1.9.5" wgpu = "0.17.0" winit = "0.28.6" diff --git a/src/load_roblox.rs b/src/load_roblox.rs index 880f1c20..0972fabe 100644 --- a/src/load_roblox.rs +++ b/src/load_roblox.rs @@ -36,7 +36,7 @@ struct RobloxAssetIdParseErr; impl std::str::FromStr for RobloxAssetId { type Err=RobloxAssetIdParseErr; fn from_str(s: &str) -> Result{ - let regman=regex::Regex::new(r"(\d+)$").unwrap(); + let regman=lazy_regex::regex!(r"(\d+)$"); if let Some(captures) = regman.captures(s) { if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture if let Ok(id) = captures[0].parse::() {