Skip to content

Commit 4ad030b

Browse files
committed
Remove lazy_static dependency
Instead, we now use `lazy-regex`, which uses `once_cell` under the hood, which might eventually become part of std.
1 parent 869c92b commit 4ad030b

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Diff for: influxdb/Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ chrono = { version = "0.4.23", features = ["serde"], default-features = false }
1717
futures-util = "0.3.17"
1818
http = "0.2.4"
1919
influxdb_derive = { version = "0.5.1", optional = true }
20-
lazy_static = "1.4.0"
21-
regex = "1.3.5"
20+
lazy-regex = "3.1"
2221
reqwest = { version = "0.11.4", default-features = false, optional = true }
2322
surf = { version = "2.2.0", default-features = false, optional = true }
2423
serde = { version = "1.0.186", optional = true }

Diff for: influxdb/src/query/line_proto_term.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
/// InfluxDB Line Protocol escaping helper module.
22
/// https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/
33
use crate::Type;
4-
use lazy_static::lazy_static;
5-
use regex::Regex;
6-
7-
lazy_static! {
8-
pub static ref COMMAS_SPACES: Regex = Regex::new("[, ]").unwrap();
9-
pub static ref COMMAS_SPACES_EQUALS: Regex = Regex::new("[, =]").unwrap();
10-
pub static ref QUOTES_SLASHES: Regex = Regex::new(r#"["\\]"#).unwrap();
11-
pub static ref SLASHES: Regex = Regex::new(r#"(\\|,| |=|")"#).unwrap();
12-
}
4+
use lazy_regex::{lazy_regex, Lazy, Regex};
5+
6+
pub static COMMAS_SPACES: Lazy<Regex> = lazy_regex!("[, ]");
7+
pub static COMMAS_SPACES_EQUALS: Lazy<Regex> = lazy_regex!("[, =]");
8+
pub static QUOTES_SLASHES: Lazy<Regex> = lazy_regex!(r#"["\\]"#);
9+
pub static SLASHES: Lazy<Regex> = lazy_regex!(r#"(\\|,| |=|")"#);
1310

1411
pub enum LineProtoTerm<'a> {
1512
Measurement(&'a str), // escape commas, spaces

0 commit comments

Comments
 (0)