diff --git a/Cargo.lock b/Cargo.lock index 573a05b..7f3eae9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -759,11 +759,11 @@ dependencies = [ "futures-util", "http-body-util", "hyper 1.0.0-rc.3", + "lazy_static", "nom", "prometheus", "quick-xml", "regex", - "regex_static", "reqwest", "rustls-pemfile", "serde", @@ -1211,7 +1211,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] @@ -1222,55 +1222,15 @@ checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" -[[package]] -name = "regex_static" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6126d61c5e4b41929098f73b42fc1d257116cc95d19739248c51591f77cc0021" -dependencies = [ - "once_cell", - "regex", - "regex_static_macro", -] - -[[package]] -name = "regex_static_impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3755019886a70e772e6360b0b58501d75cf7dc17a53e08aa97e59ecb2c2bc5" -dependencies = [ - "proc-macro2", - "quote", - "regex-syntax 0.6.29", - "syn 1.0.109", -] - -[[package]] -name = "regex_static_macro" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b15495fd034158635bc8b762a132dfc83864d6992aeda1ffabf01b03b611a1" -dependencies = [ - "proc-macro2", - "regex_static_impl", - "syn 1.0.109", -] - [[package]] name = "reqwest" version = "0.11.18" diff --git a/Cargo.toml b/Cargo.toml index cf187bf..8cac874 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ tracing-subscriber = "0.3.16" futures-util = "0.3.25" prometheus = { version = "0.13.3", default-features = false } regex = "1.7.1" -regex_static = "0.1.1" +lazy_static = "1.4.0" nom = "7.1.3" tokio-rustls = "0.24.1" rustls-pemfile = "1.0.2" diff --git a/src/protos/xmpp/bind.rs b/src/protos/xmpp/bind.rs index c0ee7d3..35d0dfc 100644 --- a/src/protos/xmpp/bind.rs +++ b/src/protos/xmpp/bind.rs @@ -42,8 +42,12 @@ impl Display for Jid { impl Jid { pub fn from_string(i: &str) -> Result { - let re = regex_static::static_regex!(r"^(([a-zA-Z]+)@)?([a-zA-Z.]+)(/([a-zA-Z\-]+))?$"); - let m = re + use regex::Regex; + use lazy_static::lazy_static; + lazy_static! { + static ref RE: Regex = Regex::new(r"^(([a-zA-Z]+)@)?([a-zA-Z.]+)(/([a-zA-Z\-]+))?$").unwrap(); + } + let m = RE .captures(i) .ok_or(ffail!("Incorrectly format jid: {i}"))?;