From 3a62a6f34aef726c76e55f318584abcd82d1fa07 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Apr 2018 08:17:16 -0400 Subject: [PATCH 1/2] fix(command): don't need command in function name --- src/command.rs | 6 +++--- src/main.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/command.rs b/src/command.rs index 0462520..bd1f991 100644 --- a/src/command.rs +++ b/src/command.rs @@ -46,7 +46,7 @@ pub fn create_pkg_dir(path: &str) -> result::Result<(), Error> { Ok(()) } -pub fn init_command(path: Option, scope: Option) -> result::Result<(), Error> { +pub fn init(path: Option, scope: Option) -> result::Result<(), Error> { let started = Instant::now(); let crate_path = set_crate_path(path); @@ -73,7 +73,7 @@ pub fn init_command(path: Option, scope: Option) -> result::Resu Ok(()) } -pub fn pack_command(path: Option) -> result::Result<(), Error> { +pub fn pack(path: Option) -> result::Result<(), Error> { let crate_path = set_crate_path(path); npm::npm_pack(&crate_path); @@ -81,7 +81,7 @@ pub fn pack_command(path: Option) -> result::Result<(), Error> { Ok(()) } -pub fn publish_command(path: Option) -> result::Result<(), Error> { +pub fn publish(path: Option) -> result::Result<(), Error> { let crate_path = set_crate_path(path); npm::npm_publish(&crate_path); diff --git a/src/main.rs b/src/main.rs index afc7355..4847aba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,16 +6,16 @@ extern crate quicli; use quicli::prelude::*; use wasm_pack::Cli; -use wasm_pack::command::{init_command, pack_command, publish_command, Command}; +use wasm_pack::command::{init, pack, publish, Command}; main!(|args: Cli, log_level: verbosity| match args.cmd { Command::Init { path, scope } => { - init_command(path, scope)?; + init(path, scope)?; } Command::Pack { path } => { - pack_command(path)?; + pack(path)?; } Command::Publish { path } => { - publish_command(path)?; + publish(path)?; } }); From f5ec67c084aaf56b3904edf1ebdec2b99d7ecec7 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Apr 2018 08:32:58 -0400 Subject: [PATCH 2/2] fix(style): appease cargo fmt --- src/bindgen.rs | 2 +- src/build.rs | 2 +- src/command.rs | 2 +- src/main.rs | 2 +- src/manifest.rs | 2 +- src/readme.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index af8e17c..19cafeb 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,7 +1,7 @@ -use PBAR; use console::style; use emoji; use std::process::Command; +use PBAR; pub fn cargo_install_wasm_bindgen() { let step = format!( diff --git a/src/build.rs b/src/build.rs index f6953a5..aa3b807 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,7 +1,7 @@ -use PBAR; use console::style; use emoji; use std::process::Command; +use PBAR; pub fn rustup_add_wasm_target() { let step = format!( diff --git a/src/command.rs b/src/command.rs index bd1f991..0abde7b 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,4 +1,3 @@ -use PBAR; use bindgen; use build; use console::style; @@ -12,6 +11,7 @@ use readme; use std::fs; use std::result; use std::time::Instant; +use PBAR; #[derive(Debug, StructOpt)] pub enum Command { diff --git a/src/main.rs b/src/main.rs index 4847aba..2b4caa0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,8 +5,8 @@ extern crate indicatif; extern crate quicli; use quicli::prelude::*; -use wasm_pack::Cli; use wasm_pack::command::{init, pack, publish, Command}; +use wasm_pack::Cli; main!(|args: Cli, log_level: verbosity| match args.cmd { Command::Init { path, scope } => { diff --git a/src/manifest.rs b/src/manifest.rs index c60583a..b7a6fb7 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -1,12 +1,12 @@ use std::fs::File; use std::io::prelude::*; -use PBAR; use console::style; use emoji; use failure::Error; use serde_json; use toml; +use PBAR; #[derive(Deserialize)] struct CargoManifest { diff --git a/src/readme.rs b/src/readme.rs index b050306..fa9d4d3 100644 --- a/src/readme.rs +++ b/src/readme.rs @@ -2,8 +2,8 @@ use console::style; use failure::Error; use std::fs; -use PBAR; use emoji; +use PBAR; pub fn copy_from_crate(path: &str) -> Result<(), Error> { let step = format!(