Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Nov 21, 2019
1 parent 8f62549 commit a71b951
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
)]
extern crate structopt;

use clap;
use std::env;
use std::fs::{read_to_string, File};
use std::io;
use std::io::Read;
use std::path::PathBuf;
use std::process::exit;
use std::str::FromStr;
use clap;

use std::collections::HashMap;
use structopt::StructOpt;
Expand Down Expand Up @@ -853,18 +853,15 @@ fn main() {
// Eg. `wasmer <SUBCOMMAND>`
// In case that fails, we fallback trying the Run subcommand directly.
// Eg. `wasmer myfile.wasm --dir=.`
let options = CLIOptions::from_iter_safe(env::args())
.unwrap_or_else(|e| {
match e.kind {
// This fixes a issue that:
// 1. Shows the version twice when doing `wasmer -V`
// 2. Shows the run help (instead of normal help) when doing `wasmer --help`
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => {
e.exit()
}
_ => CLIOptions::Run(Run::from_args())
}
});
let options = CLIOptions::from_iter_safe(env::args()).unwrap_or_else(|e| {
match e.kind {
// This fixes a issue that:
// 1. Shows the version twice when doing `wasmer -V`
// 2. Shows the run help (instead of normal help) when doing `wasmer --help`
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => e.exit(),
_ => CLIOptions::Run(Run::from_args()),
}
});
match options {
CLIOptions::Run(options) => run(options),
#[cfg(not(target_os = "windows"))]
Expand Down

0 comments on commit a71b951

Please sign in to comment.