diff --git a/.travis.yml b/.travis.yml index 9769467..c398f90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,7 @@ matrix: - rustup component add rustfmt-preview - cargo fmt --version - cargo fmt --all -- --check -# - rustup component add clippy-preview + - rustup component add clippy-preview # - cargo clippy --version # - cargo clippy diff --git a/src/command/test.rs b/src/command/test.rs index 952edd2..948ea02 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -382,6 +382,6 @@ impl Test { if !self.headless { envs.push(("NO_HEADLESS", "1")); } - return envs; + envs } } diff --git a/src/main.rs b/src/main.rs index ec6a470..d40a18c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,8 +64,7 @@ fn run() -> Result<(), failure::Error> { // If we're actually running as the installer then execute our // self-installation, otherwise just continue as usual. if me - .file_stem() - .and_then(|s| s.to_str()) + .file_stem().and_then(|s| s.to_str()) .expect("executable should have a filename") .starts_with("wasm-pack-init") { @@ -94,18 +93,15 @@ fn setup_panic_hooks() { let default_hook = panic::take_hook(); - match env::var("RUST_BACKTRACE") { - Err(_) => { - panic::set_hook(Box::new(move |info: &panic::PanicInfo| { - // First call the default hook that prints to standard error. - default_hook(info); - - // Then call human_panic. - let file_path = human_panic::handle_dump(&meta, info); - human_panic::print_msg(file_path, &meta) - .expect("human-panic: printing error message to console failed"); - })); - } - Ok(_) => {} + if let Err(_) = env::var("RUST_BACKTRACE") { + panic::set_hook(Box::new(move |info: &panic::PanicInfo| { + // First call the default hook that prints to standard error. + default_hook(info); + + // Then call human_panic. + let file_path = human_panic::handle_dump(&meta, info); + human_panic::print_msg(file_path, &meta) + .expect("human-panic: printing error message to console failed"); + })); } } diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 465db20..d23d867 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -173,7 +173,7 @@ impl Crate { fn override_stamp_file( current_time: DateTime, - version: &String, + version: &str, ) -> Result<(), failure::Error> { let path = env::current_exe()?; @@ -210,15 +210,13 @@ impl Crate { } /// Read the stamp file and return value assigned to a certain key. - fn return_stamp_file_value(file: &String, word: &str) -> Option { + fn return_stamp_file_value(file: &str, word: &str) -> Option { let created = file .lines() .find(|line| line.starts_with(word)) .and_then(|l| l.split_whitespace().nth(1)); - let value = created.map(|s| s.to_string()); - - value + created.map(|s| s.to_string()) } /// Call to the crates.io api and return the latest version of `wasm-pack`