diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-06-04 13:42:57 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-04 13:42:57 +0900 |
| commit | 5b0a49efa8d5ecc2838edfb93820e46dbff1a606 (patch) | |
| tree | 2691dc0d2bd9bd291fd5a232391fcee10c44a886 /src/tools | |
| parent | 3500e76330c92196064d5ebdee6dfcd3f56c193c (diff) | |
| parent | 5afc594e6294cee451ded335397cade6a9098bd1 (diff) | |
Rollup merge of #85899 - klensy:jsondocck-f, r=Mark-Simulacrum
jsondocck small cleanup updated `shlex` (there was some fix https://github.com/comex/rust-shlex/commit/6db4704fcad8393dd6947b1d31720327546a84a2) replaced `lazy_static` with `once_cell` removed `serde` direct dependency (`serde_json` will pull it)
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/jsondocck/Cargo.toml | 5 | ||||
| -rw-r--r-- | src/tools/jsondocck/src/main.rs | 12 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/tools/jsondocck/Cargo.toml b/src/tools/jsondocck/Cargo.toml index a6efc4c9a6b..b5f1554dbe4 100644 --- a/src/tools/jsondocck/Cargo.toml +++ b/src/tools/jsondocck/Cargo.toml @@ -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" diff --git a/src/tools/jsondocck/src/main.rs b/src/tools/jsondocck/src/main.rs index 216890d59ad..b8ea10f3d22 100644 --- a/src/tools/jsondocck/src/main.rs +++ b/src/tools/jsondocck/src/main.rs @@ -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) |
