Rollup merge of #85899 - klensy:jsondocck-f, r=Mark-Simulacrum

jsondocck small cleanup

updated `shlex` (there was some fix 6db4704fca)
replaced `lazy_static` with `once_cell`
removed `serde` direct dependency (`serde_json` will pull it)
This commit is contained in:
Yuki Okushi 2021-06-04 13:42:57 +09:00 committed by GitHub
commit 5b0a49efa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 19 deletions

View File

@ -1753,11 +1753,10 @@ dependencies = [
"fs-err",
"getopts",
"jsonpath_lib",
"lazy_static",
"once_cell",
"regex",
"serde",
"serde_json",
"shlex 0.1.1",
"shlex",
]
[[package]]
@ -2138,7 +2137,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"shlex 1.0.0",
"shlex",
"tempfile",
"toml",
]
@ -4813,12 +4812,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "shlex"
version = "1.0.0"

View File

@ -8,8 +8,7 @@ edition = "2018"
jsonpath_lib = "0.2"
getopts = "0.2"
regex = "1.4"
lazy_static = "1.4"
shlex = "0.1"
serde = "1.0"
shlex = "1.0"
serde_json = "1.0"
fs-err = "2.5.0"
once_cell = "1.0"

View File

@ -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 @@ impl fmt::Display for CommandKind {
}
}
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)