fix(lint): re-enable clippy, fix lints

master
Ashley Williams 6 years ago
parent d6baf439b7
commit b96538ec23
  1. 2
      .travis.yml
  2. 2
      src/command/test.rs
  3. 26
      src/main.rs
  4. 8
      src/manifest/mod.rs

@ -51,7 +51,7 @@ matrix:
- rustup component add rustfmt-preview - rustup component add rustfmt-preview
- cargo fmt --version - cargo fmt --version
- cargo fmt --all -- --check - cargo fmt --all -- --check
# - rustup component add clippy-preview - rustup component add clippy-preview
# - cargo clippy --version # - cargo clippy --version
# - cargo clippy # - cargo clippy

@ -382,6 +382,6 @@ impl Test {
if !self.headless { if !self.headless {
envs.push(("NO_HEADLESS", "1")); envs.push(("NO_HEADLESS", "1"));
} }
return envs; envs
} }
} }

@ -64,8 +64,7 @@ fn run() -> Result<(), failure::Error> {
// If we're actually running as the installer then execute our // If we're actually running as the installer then execute our
// self-installation, otherwise just continue as usual. // self-installation, otherwise just continue as usual.
if me if me
.file_stem() .file_stem().and_then(|s| s.to_str())
.and_then(|s| s.to_str())
.expect("executable should have a filename") .expect("executable should have a filename")
.starts_with("wasm-pack-init") .starts_with("wasm-pack-init")
{ {
@ -94,18 +93,15 @@ fn setup_panic_hooks() {
let default_hook = panic::take_hook(); let default_hook = panic::take_hook();
match env::var("RUST_BACKTRACE") { if let Err(_) = env::var("RUST_BACKTRACE") {
Err(_) => { panic::set_hook(Box::new(move |info: &panic::PanicInfo| {
panic::set_hook(Box::new(move |info: &panic::PanicInfo| { // First call the default hook that prints to standard error.
// First call the default hook that prints to standard error. default_hook(info);
default_hook(info);
// Then call human_panic.
// Then call human_panic. let file_path = human_panic::handle_dump(&meta, info);
let file_path = human_panic::handle_dump(&meta, info); human_panic::print_msg(file_path, &meta)
human_panic::print_msg(file_path, &meta) .expect("human-panic: printing error message to console failed");
.expect("human-panic: printing error message to console failed"); }));
}));
}
Ok(_) => {}
} }
} }

@ -173,7 +173,7 @@ impl Crate {
fn override_stamp_file( fn override_stamp_file(
current_time: DateTime<offset::Local>, current_time: DateTime<offset::Local>,
version: &String, version: &str,
) -> Result<(), failure::Error> { ) -> Result<(), failure::Error> {
let path = env::current_exe()?; let path = env::current_exe()?;
@ -210,15 +210,13 @@ impl Crate {
} }
/// Read the stamp file and return value assigned to a certain key. /// Read the stamp file and return value assigned to a certain key.
fn return_stamp_file_value(file: &String, word: &str) -> Option<String> { fn return_stamp_file_value(file: &str, word: &str) -> Option<String> {
let created = file let created = file
.lines() .lines()
.find(|line| line.starts_with(word)) .find(|line| line.starts_with(word))
.and_then(|l| l.split_whitespace().nth(1)); .and_then(|l| l.split_whitespace().nth(1));
let value = created.map(|s| s.to_string()); created.map(|s| s.to_string())
value
} }
/// Call to the crates.io api and return the latest version of `wasm-pack` /// Call to the crates.io api and return the latest version of `wasm-pack`

Loading…
Cancel
Save