Skip to content

Commit

Permalink
chore: remove feature gates from json examples
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeMasen committed Nov 24, 2022
1 parent 82c153b commit 630db82
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
10 changes: 2 additions & 8 deletions examples/js_to_json-esprima.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use docopt::Docopt;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use std::{
error::Error,
ffi::OsStr,
Expand Down Expand Up @@ -29,12 +29,6 @@ struct Args {
flag_out: Option<PathBuf>,
}

#[cfg(not(feature = "esprima"))]
fn main() {
println!("Please run again with --features esprima");
}

#[cfg(feature = "esprima")]
fn main() -> Result<(), Box<dyn Error>> {
let args: Args = Docopt::new(USAGE)
.and_then(|o| o.deserialize())
Expand All @@ -54,7 +48,7 @@ fn main() -> Result<(), Box<dyn Error>> {
}
Ok(())
}
#[cfg(feature = "esprima")]

fn gen_json(from: PathBuf, pretty: bool) -> Result<String, Box<dyn Error>> {
let js = read_to_string(&from)?;
let mut p = Parser::builder()
Expand Down
9 changes: 2 additions & 7 deletions examples/js_to_json.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use docopt::Docopt;
use serde::Deserialize;
use std::{
error::Error,
ffi::OsStr,
Expand Down Expand Up @@ -28,12 +29,6 @@ struct Args {
flag_out: Option<PathBuf>,
}

#[cfg(not(feature = "serialization"))]
fn main() {
println!("Please run again with --features serialization");
}

#[cfg(feature = "serialization")]
fn main() -> Result<(), Box<dyn Error>> {
let args: Args = Docopt::new(USAGE)
.and_then(|o| o.deserialize())
Expand All @@ -53,7 +48,7 @@ fn main() -> Result<(), Box<dyn Error>> {
}
Ok(())
}
#[cfg(feature = "serialization")]

fn gen_json(from: PathBuf, pretty: bool) -> Result<String, Box<dyn Error>> {
let js = read_to_string(&from)?;
let mut p = Parser::builder()
Expand Down

0 comments on commit 630db82

Please sign in to comment.