Skip to content

Commit

Permalink
Remove lazy_static dependency
Browse files Browse the repository at this point in the history
Instead, we now use `lazy-regex`, which uses `once_cell` under
the hood, which might eventually become part of std.
  • Loading branch information
msrd0 committed Mar 11, 2024
1 parent 869c92b commit accb3a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions influxdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ chrono = { version = "0.4.23", features = ["serde"], default-features = false }
futures-util = "0.3.17"
http = "0.2.4"
influxdb_derive = { version = "0.5.1", optional = true }
lazy_static = "1.4.0"
regex = "1.3.5"
lazy-regex = "3.1"
reqwest = { version = "0.11.4", default-features = false, optional = true }
surf = { version = "2.2.0", default-features = false, optional = true }
serde = { version = "1.0.186", optional = true }
Expand Down
15 changes: 6 additions & 9 deletions influxdb/src/query/line_proto_term.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/// InfluxDB Line Protocol escaping helper module.
/// https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/
use crate::Type;
use lazy_static::lazy_static;
use regex::Regex;

lazy_static! {
pub static ref COMMAS_SPACES: Regex = Regex::new("[, ]").unwrap();
pub static ref COMMAS_SPACES_EQUALS: Regex = Regex::new("[, =]").unwrap();
pub static ref QUOTES_SLASHES: Regex = Regex::new(r#"["\\]"#).unwrap();
pub static ref SLASHES: Regex = Regex::new(r#"(\\|,| |=|")"#).unwrap();
}
use lazy_regex::{regex, Regex};

pub static COMMAS_SPACES: &Regex = regex!("[, ]");
pub static COMMAS_SPACES_EQUALS: &Regex = regex!("[, =]");
pub static QUOTES_SLASHES: &Regex = regex!(r#"["\\]"#);
pub static SLASHES: &Regex = regex!(r#"(\\|,| |=|")"#);

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

0 comments on commit accb3a2

Please sign in to comment.