Fix lint issues

This commit is contained in:
Syrus 2019-11-20 17:19:42 -08:00
parent 8f62549819
commit a71b9519c4

View File

@ -9,6 +9,7 @@
)]
extern crate structopt;
use clap;
use std::env;
use std::fs::{read_to_string, File};
use std::io;
@ -16,7 +17,6 @@ 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;
@ -853,16 +853,13 @@ 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| {
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())
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => e.exit(),
_ => CLIOptions::Run(Run::from_args()),
}
});
match options {