Skip to content

Commit

Permalink
Fix clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Mar 18, 2023
1 parent f69be80 commit d451d75
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,30 +258,17 @@ fn generate_flowgraph(
Ok(result)
}

fn main() -> Result<(), io::Error> {
let args = Opt::parse();

let queue = Jobs::default();
let mut context = ContextBuilder::new()
.job_queue(&queue)
.build()
.expect("cannot fail with default global object");

// Trace Output
context.set_trace(args.trace);
context.optimize(args.optimize);
context.optimizer_statistics(args.optimizer_statistics);

fn evaluate_files(args: &Opt, context: &mut Context<'_>) -> Result<(), io::Error> {
for file in &args.files {
let buffer = read(file)?;

if args.has_dump_flag() {
if let Err(e) = dump(&buffer, &args, &mut context) {
if let Err(e) = dump(&buffer, args, context) {
eprintln!("{e}");
}
} else if let Some(flowgraph) = args.flowgraph {
match generate_flowgraph(
&mut context,
context,
&buffer,
flowgraph.unwrap_or(FlowgraphFormat::Graphviz),
args.flowgraph_direction,
Expand All @@ -298,6 +285,23 @@ fn main() -> Result<(), io::Error> {
}
}

Ok(())
}

fn main() -> Result<(), io::Error> {
let args = Opt::parse();

let queue = Jobs::default();
let mut context = ContextBuilder::new()
.job_queue(&queue)
.build()
.expect("cannot fail with default global object");

// Trace Output
context.set_trace(args.trace);
context.optimize(args.optimize);
context.optimizer_statistics(args.optimizer_statistics);

if args.files.is_empty() {
let config = Config::builder()
.keyseq_timeout(1)
Expand Down Expand Up @@ -371,6 +375,8 @@ fn main() -> Result<(), io::Error> {
editor
.save_history(CLI_HISTORY)
.expect("could not save CLI history");
} else {
evaluate_files(&args, &mut context)?;
}

Ok(())
Expand Down

0 comments on commit d451d75

Please sign in to comment.