Skip to content

Commit

Permalink
run cargo fmt again
Browse files Browse the repository at this point in the history
  • Loading branch information
xmclark committed Oct 5, 2018
1 parent 662a969 commit b8d90c8
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 27 deletions.
6 changes: 4 additions & 2 deletions src/binaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ pub fn bin_path(log: &Logger, crate_path: &Path, bin: &str) -> Option<PathBuf> {
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
})
Expand Down Expand Up @@ -124,7 +125,8 @@ fn curl(url: &str) -> Result<Vec<u8>, failure::Error> {
Err(Error::http(&format!(
"received a bad HTTP status code ({}) when requesting {}",
status_code, url
)).into())
))
.into())
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,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
Expand Down
6 changes: 4 additions & 2 deletions src/command/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion src/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ fn get_lockfile_path(crate_path: &Path) -> Result<PathBuf, Error> {
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");
Expand Down
3 changes: 2 additions & 1 deletion src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ fn read_cargo_toml(path: &Path) -> Result<CargoManifest, Error> {
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();
Expand Down
6 changes: 4 additions & 2 deletions src/test/webdriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()),
}
}

Expand Down Expand Up @@ -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!()),
}
}

Expand Down
3 changes: 2 additions & 1 deletion tests/all/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
18 changes: 12 additions & 6 deletions tests/all/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
[workspace]
members = ["./blah"]
"#,
).file(
)
.file(
"blah/Cargo.toml",
r#"
[package]
Expand All @@ -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;
Expand All @@ -69,7 +71,8 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
[workspace]
members = ["./parent", "./child"]
"#,
).file(
)
.file(
"child/Cargo.toml",
r#"
[package]
Expand All @@ -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;
Expand All @@ -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]
Expand All @@ -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`.
Expand Down
3 changes: 2 additions & 1 deletion tests/all/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
6 changes: 4 additions & 2 deletions tests/all/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 {
Expand Down
21 changes: 14 additions & 7 deletions tests/all/utils/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -374,7 +379,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;
Expand All @@ -383,7 +389,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;
Expand Down

0 comments on commit b8d90c8

Please sign in to comment.