fix(style): appease cargo fmt

master
Ashley Williams 7 years ago
parent 180c2386ad
commit 4d5c7b8b3a
  1. 8
      src/command/init.rs
  2. 22
      tests/manifest/main.rs

@ -161,7 +161,13 @@ impl Init {
fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), Error> {
info!(&log, "Writing a package.json..."); info!(&log, "Writing a package.json...");
manifest::write_package_json(&self.crate_path, &self.scope, self.disable_dts, &self.target, step)?; manifest::write_package_json(
&self.crate_path,
&self.scope,
self.disable_dts,
&self.target,
step,
)?;
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
info!( info!(
&log, &log,

@ -65,8 +65,7 @@ fn it_creates_a_package_json_default_path() {
assert_eq!(types, "wasm_pack.d.ts"); assert_eq!(types, "wasm_pack.d.ts");
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = let expected_files: HashSet<String> = ["wasm_pack_bg.wasm", "wasm_pack.d.ts"]
["wasm_pack_bg.wasm", "wasm_pack.d.ts"]
.iter() .iter()
.map(|&s| String::from(s)) .map(|&s| String::from(s))
.collect(); .collect();
@ -87,10 +86,8 @@ fn it_creates_a_package_json_provided_path() {
assert_eq!(pkg.main, "js_hello_world.js"); assert_eq!(pkg.main, "js_hello_world.js");
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = [ let expected_files: HashSet<String> = ["js_hello_world_bg.wasm", "js_hello_world.d.ts"]
"js_hello_world_bg.wasm", .iter()
"js_hello_world.d.ts",
].iter()
.map(|&s| String::from(s)) .map(|&s| String::from(s))
.collect(); .collect();
assert_eq!(actual_files, expected_files); assert_eq!(actual_files, expected_files);
@ -101,7 +98,9 @@ fn it_creates_a_package_json_provided_path_with_scope() {
let step = wasm_pack::progressbar::Step::new(1); let step = wasm_pack::progressbar::Step::new(1);
let path = "tests/fixtures/scopes".to_string(); let path = "tests/fixtures/scopes".to_string();
wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap();
assert!(manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok()); assert!(
manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok()
);
let package_json_path = format!("{}/pkg/package.json", &path); let package_json_path = format!("{}/pkg/package.json", &path);
assert!(fs::metadata(package_json_path).is_ok()); assert!(fs::metadata(package_json_path).is_ok());
assert!(utils::read_package_json(&path).is_ok()); assert!(utils::read_package_json(&path).is_ok());
@ -110,10 +109,8 @@ fn it_creates_a_package_json_provided_path_with_scope() {
assert_eq!(pkg.main, "scopes_hello_world.js"); assert_eq!(pkg.main, "scopes_hello_world.js");
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = [ let expected_files: HashSet<String> = ["scopes_hello_world_bg.wasm", "scopes_hello_world.d.ts"]
"scopes_hello_world_bg.wasm", .iter()
"scopes_hello_world.d.ts",
].iter()
.map(|&s| String::from(s)) .map(|&s| String::from(s))
.collect(); .collect();
assert_eq!(actual_files, expected_files); assert_eq!(actual_files, expected_files);
@ -167,8 +164,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
assert_eq!(pkg.main, "wasm_pack.js"); assert_eq!(pkg.main, "wasm_pack.js");
let actual_files: HashSet<String> = pkg.files.into_iter().collect(); let actual_files: HashSet<String> = pkg.files.into_iter().collect();
let expected_files: HashSet<String> = let expected_files: HashSet<String> = ["wasm_pack_bg.wasm"]
["wasm_pack_bg.wasm"]
.iter() .iter()
.map(|&s| String::from(s)) .map(|&s| String::from(s))
.collect(); .collect();

Loading…
Cancel
Save