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; extern crate structopt;
use clap;
use std::env; use std::env;
use std::fs::{read_to_string, File}; use std::fs::{read_to_string, File};
use std::io; use std::io;
@ -16,7 +17,6 @@ use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
use std::str::FromStr; use std::str::FromStr;
use clap;
use std::collections::HashMap; use std::collections::HashMap;
use structopt::StructOpt; use structopt::StructOpt;
@ -853,18 +853,15 @@ fn main() {
// Eg. `wasmer <SUBCOMMAND>` // Eg. `wasmer <SUBCOMMAND>`
// In case that fails, we fallback trying the Run subcommand directly. // In case that fails, we fallback trying the Run subcommand directly.
// Eg. `wasmer myfile.wasm --dir=.` // Eg. `wasmer myfile.wasm --dir=.`
let options = CLIOptions::from_iter_safe(env::args()) let options = CLIOptions::from_iter_safe(env::args()).unwrap_or_else(|e| {
.unwrap_or_else(|e| { match e.kind {
match e.kind { // This fixes a issue that:
// This fixes a issue that: // 1. Shows the version twice when doing `wasmer -V`
// 1. Shows the version twice when doing `wasmer -V` // 2. Shows the run help (instead of normal help) when doing `wasmer --help`
// 2. Shows the run help (instead of normal help) when doing `wasmer --help` clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => e.exit(),
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => { _ => CLIOptions::Run(Run::from_args()),
e.exit() }
} });
_ => CLIOptions::Run(Run::from_args())
}
});
match options { match options {
CLIOptions::Run(options) => run(options), CLIOptions::Run(options) => run(options),
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]