diff --git a/src/binaries.rs b/src/binaries.rs index a414405..82eacb7 100644 --- a/src/binaries.rs +++ b/src/binaries.rs @@ -78,7 +78,8 @@ pub fn bin_path(log: &Logger, crate_path: &Path, bin: &str) -> Option { let p = p.canonicalize().unwrap_or(p); debug!(log, "Using {} binary at {}", bin, p.display()); p - }).or_else(|| { + }) + .or_else(|| { debug!(log, "Could not find {} binary.", bin); None }) @@ -124,7 +125,8 @@ fn curl(url: &str) -> Result, failure::Error> { Err(Error::http(&format!( "received a bad HTTP status code ({}) when requesting {}", status_code, url - )).into()) + )) + .into()) } } diff --git a/src/bindgen.rs b/src/bindgen.rs index d3d9e58..a1a1e5f 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -184,8 +184,10 @@ fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &L dep_version ); v == dep_version - }).unwrap_or(false) - }).unwrap_or(false) + }) + .unwrap_or(false) + }) + .unwrap_or(false) } /// Return a `PathBuf` containing the path to either the local wasm-bindgen diff --git a/src/command/test.rs b/src/command/test.rs index 5ef88fe..1bf2e97 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -126,14 +126,16 @@ impl Test { if !node && !any_browser { return Error::crate_config( "Must specify at least one of `--node`, `--chrome`, `--firefox`, or `--safari`", - ).map(|_| unreachable!()); + ) + .map(|_| unreachable!()); } if headless && !any_browser { return Error::crate_config( "The `--headless` flag only applies to browser tests. Node does not provide a UI, \ so it doesn't make sense to talk about a headless version of Node tests.", - ).map(|_| unreachable!()); + ) + .map(|_| unreachable!()); } Ok(Test { diff --git a/src/lockfile.rs b/src/lockfile.rs index 2ed5110..e016802 100644 --- a/src/lockfile.rs +++ b/src/lockfile.rs @@ -69,7 +69,8 @@ fn get_lockfile_path(crate_path: &Path) -> Result { let crate_root = cargo_metadata::metadata(Some(&manifest)) .map_err(|_| Error::CrateConfig { message: String::from("Error while processing crate metadata"), - })?.workspace_root; + })? + .workspace_root; // Check that a lock file can be found in the directory. Return an error // if it cannot, otherwise return the path buffer. let lockfile_path = Path::new(&crate_root).join("Cargo.lock"); diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index eb2744c..4b559db 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -81,7 +81,8 @@ fn read_cargo_toml(path: &Path) -> Result { return Error::crate_config(&format!( "Crate directory is missing a `Cargo.toml` file; is `{}` the wrong directory?", path.display() - )).map(|_| unreachable!()); + )) + .map(|_| unreachable!()); } let mut cargo_file = File::open(manifest_path)?; let mut cargo_contents = String::new(); diff --git a/src/test/webdriver.rs b/src/test/webdriver.rs index 5668f6a..ad83e3c 100644 --- a/src/test/webdriver.rs +++ b/src/test/webdriver.rs @@ -24,7 +24,8 @@ pub fn get_or_install_chromedriver( "No crate-local `chromedriver` binary found, and could not find a global \ `chromedriver` on the `$PATH`. Not installing `chromedriver` because of noinstall \ mode.", - ).map(|_| unreachable!()), + ) + .map(|_| unreachable!()), } } @@ -74,7 +75,8 @@ pub fn get_or_install_geckodriver( (BuildMode::Noinstall, None) => Error::crate_config( "No crate-local `geckodriver` binary found, and could not find a global `geckodriver` \ on the `$PATH`. Not installing `geckodriver` because of noinstall mode.", - ).map(|_| unreachable!()), + ) + .map(|_| unreachable!()), } } diff --git a/tests/all/build.rs b/tests/all/build.rs index 3c35873..69a9bab 100644 --- a/tests/all/build.rs +++ b/tests/all/build.rs @@ -9,7 +9,8 @@ fn build_in_non_crate_directory_doesnt_panic() { "wasm-pack", "build", &fixture.path.display().to_string(), - ]).unwrap(); + ]) + .unwrap(); let logger = logger::new(&cli.cmd, cli.verbosity).unwrap(); let result = command::run_wasm_pack(cli.cmd, &logger); assert!( diff --git a/tests/all/lockfile.rs b/tests/all/lockfile.rs index 1ee6e3b..0752145 100644 --- a/tests/all/lockfile.rs +++ b/tests/all/lockfile.rs @@ -27,7 +27,8 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [workspace] members = ["./blah"] "#, - ).file( + ) + .file( "blah/Cargo.toml", r#" [package] @@ -44,7 +45,8 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( "blah/src/lib.rs", r#" extern crate wasm_bindgen; @@ -69,7 +71,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [workspace] members = ["./parent", "./child"] "#, - ).file( + ) + .file( "child/Cargo.toml", r#" [package] @@ -86,7 +89,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [dependencies] wasm-bindgen = "=0.2.21" "#, - ).file( + ) + .file( "child/src/lib.rs", r#" extern crate wasm_bindgen; @@ -95,7 +99,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { #[wasm_bindgen] pub fn hello() -> u32 { 42 } "#, - ).file( + ) + .file( "parent/Cargo.toml", r#" [package] @@ -109,7 +114,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() { [lib] crate-type = ["cdylib"] "#, - ).file( + ) + .file( "parent/src/lib.rs", r#" // Just re-export all of `child`. diff --git a/tests/all/manifest.rs b/tests/all/manifest.rs index 7d6c8e8..1add2b7 100644 --- a/tests/all/manifest.rs +++ b/tests/all/manifest.rs @@ -129,7 +129,8 @@ fn it_creates_a_package_json_provided_path_with_scope() { false, "", &step - ).is_ok() + ) + .is_ok() ); let package_json_path = &fixture.path.join("pkg").join("package.json"); assert!(fs::metadata(package_json_path).is_ok()); diff --git a/tests/all/test.rs b/tests/all/test.rs index 9033c5a..54d4131 100644 --- a/tests/all/test.rs +++ b/tests/all/test.rs @@ -122,7 +122,8 @@ fn it_can_find_a_webdriver_on_path() { geckodriver_dir .path() .join(local_geckodriver.file_name().unwrap()), - ).unwrap(); + ) + .unwrap(); fs::remove_file(&local_geckodriver).unwrap(); let mut paths: Vec<_> = env::split_paths(&env::var("PATH").unwrap()).collect(); @@ -202,7 +203,8 @@ fn complains_about_missing_wasm_bindgen_test_dependency() { [dev-dependencies] # no wasm-bindgen-test dep here! "#, - ).hello_world_src_lib() + ) + .hello_world_src_lib() .install_local_wasm_bindgen(); let cmd = Command::Test(test::TestOptions { diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index a0fc509..c8e7611 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -152,7 +152,8 @@ impl Fixture { wasm_pack::bindgen::download_prebuilt_wasm_bindgen(&tests, WASM_BINDGEN_VERSION) .or_else(|_| { wasm_pack::bindgen::cargo_install_wasm_bindgen(&tests, WASM_BINDGEN_VERSION) - }).unwrap(); + }) + .unwrap(); }); assert!(shared_wasm_bindgen.is_file()); @@ -163,12 +164,14 @@ impl Fixture { hard_link_or_copy( &shared_wasm_bindgen, wasm_pack::binaries::local_bin_path(&self.path, "wasm-bindgen"), - ).expect("could not copy `wasm-bindgen` to fixture directory"); + ) + .expect("could not copy `wasm-bindgen` to fixture directory"); hard_link_or_copy( &shared_wasm_bindgen_test_runner, wasm_pack::binaries::local_bin_path(&self.path, "wasm-bindgen-test-runner"), - ).expect("could not copy `wasm-bindgen-test` to fixture directory"); + ) + .expect("could not copy `wasm-bindgen-test` to fixture directory"); self } @@ -202,7 +205,8 @@ impl Fixture { hard_link_or_copy( &geckodriver, wasm_pack::binaries::local_bin_path(&self.path, "geckodriver"), - ).expect("could not copy `geckodriver` to fixture directory"); + ) + .expect("could not copy `geckodriver` to fixture directory"); self } @@ -236,7 +240,8 @@ impl Fixture { hard_link_or_copy( &chromedriver, wasm_pack::binaries::local_bin_path(&self.path, "chromedriver"), - ).expect("could not copy `chromedriver` to fixture directory"); + ) + .expect("could not copy `chromedriver` to fixture directory"); self } @@ -375,7 +380,8 @@ pub fn wbg_test_diff_versions() -> Fixture { # wasm-bindgen-test at 0.2.19, and everything should still work. wasm-bindgen-test = "0.2.19" "#, - ).file( + ) + .file( "src/lib.rs", r#" extern crate wasm_bindgen; @@ -384,7 +390,8 @@ pub fn wbg_test_diff_versions() -> Fixture { #[wasm_bindgen] pub fn one() -> u32 { 1 } "#, - ).file( + ) + .file( "tests/node.rs", r#" extern crate wbg_test_diff_versions;