From 630db824e50798278f93508f62face341a70aa73 Mon Sep 17 00:00:00 2001 From: Robert Masen Date: Thu, 24 Nov 2022 11:50:50 -0600 Subject: [PATCH] chore: remove feature gates from json examples --- Cargo.toml | 3 +-- examples/js_to_json-esprima.rs | 10 ++-------- examples/js_to_json.rs | 9 ++------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 49130b8..e2b0c33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,7 @@ lazy_static = "1" serde = { version = "1", features = ["derive"] } serde_json = "1" serde_yaml = "0.9" -term = "0.6" -term-painter = "0.2.4" +term-painter = "0.3" walkdir = "2" [[bench]] diff --git a/examples/js_to_json-esprima.rs b/examples/js_to_json-esprima.rs index 2caffe1..c9cb5fc 100644 --- a/examples/js_to_json-esprima.rs +++ b/examples/js_to_json-esprima.rs @@ -1,5 +1,5 @@ use docopt::Docopt; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; use std::{ error::Error, ffi::OsStr, @@ -29,12 +29,6 @@ struct Args { flag_out: Option, } -#[cfg(not(feature = "esprima"))] -fn main() { - println!("Please run again with --features esprima"); -} - -#[cfg(feature = "esprima")] fn main() -> Result<(), Box> { let args: Args = Docopt::new(USAGE) .and_then(|o| o.deserialize()) @@ -54,7 +48,7 @@ fn main() -> Result<(), Box> { } Ok(()) } -#[cfg(feature = "esprima")] + fn gen_json(from: PathBuf, pretty: bool) -> Result> { let js = read_to_string(&from)?; let mut p = Parser::builder() diff --git a/examples/js_to_json.rs b/examples/js_to_json.rs index 32d5ca0..c9cb5fc 100644 --- a/examples/js_to_json.rs +++ b/examples/js_to_json.rs @@ -1,4 +1,5 @@ use docopt::Docopt; +use serde::Deserialize; use std::{ error::Error, ffi::OsStr, @@ -28,12 +29,6 @@ struct Args { flag_out: Option, } -#[cfg(not(feature = "serialization"))] -fn main() { - println!("Please run again with --features serialization"); -} - -#[cfg(feature = "serialization")] fn main() -> Result<(), Box> { let args: Args = Docopt::new(USAGE) .and_then(|o| o.deserialize()) @@ -53,7 +48,7 @@ fn main() -> Result<(), Box> { } Ok(()) } -#[cfg(feature = "serialization")] + fn gen_json(from: PathBuf, pretty: bool) -> Result> { let js = read_to_string(&from)?; let mut p = Parser::builder()