replace lazy_static with once_cell, drop direct dependency on serde
This commit is contained in:
parent
c63cb014a0
commit
5afc594e62
@ -1743,9 +1743,8 @@ dependencies = [
|
||||
"fs-err",
|
||||
"getopts",
|
||||
"jsonpath_lib",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"shlex",
|
||||
]
|
||||
|
@ -8,8 +8,7 @@ edition = "2018"
|
||||
jsonpath_lib = "0.2"
|
||||
getopts = "0.2"
|
||||
regex = "1.4"
|
||||
lazy_static = "1.4"
|
||||
shlex = "1.0"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
fs-err = "2.5.0"
|
||||
once_cell = "1.0"
|
||||
|
@ -1,5 +1,5 @@
|
||||
use jsonpath_lib::select;
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::{Regex, RegexBuilder};
|
||||
use serde_json::Value;
|
||||
use std::borrow::Cow;
|
||||
@ -94,19 +94,19 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref LINE_PATTERN: Regex = RegexBuilder::new(
|
||||
static LINE_PATTERN: Lazy<Regex> = Lazy::new(|| {
|
||||
RegexBuilder::new(
|
||||
r#"
|
||||
\s(?P<invalid>!?)@(?P<negated>!?)
|
||||
(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
|
||||
(?P<args>.*)$
|
||||
"#
|
||||
"#,
|
||||
)
|
||||
.ignore_whitespace(true)
|
||||
.unicode(true)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
fn print_err(msg: &str, lineno: usize) {
|
||||
eprintln!("Invalid command: {} on line {}", msg, lineno)
|
||||
|
Loading…
Reference in New Issue
Block a user