From 24dac77b59568080f833b4465faa81416aed592d Mon Sep 17 00:00:00 2001 From: csmoe <35686186+csmoe@users.noreply.github.com> Date: Tue, 17 Jul 2018 07:34:00 +0800 Subject: [PATCH] Cargo fmt --- src/command/build.rs | 16 +++++++--------- src/command/init.rs | 16 ++++------------ src/command/mod.rs | 4 ++-- src/command/utils.rs | 4 ++-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/command/build.rs b/src/command/build.rs index 8832cefe9..8e56f9c9f 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -2,7 +2,7 @@ use bindgen; use build; -use command::utils::{set_crate_path, create_pkg_dir}; +use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use error::Error; use indicatif::HumanDuration; @@ -35,7 +35,7 @@ pub enum BuildMode { } /// Everything required to configure and run the `wasm-pack build` command. -#[derive(Debug,StructOpt)] +#[derive(Debug, StructOpt)] pub struct BuildOptions { /// The path to the Rust crate. pub path: Option, @@ -60,7 +60,6 @@ pub struct BuildOptions { #[structopt(long = "debug")] /// Build without --release. debug: bool, - // build config from manifest // build_config: Option, } @@ -72,10 +71,10 @@ impl From for Build { // let build_config = manifest::xxx(&crate_path).xxx(); Build { crate_path, - scope:build_opts.scope, - disable_dts:build_opts.disable_dts, - target:build_opts.target, - debug:build_opts.debug, + scope: build_opts.scope, + disable_dts: build_opts.disable_dts, + target: build_opts.target, + debug: build_opts.debug, // build_config, crate_name, } @@ -85,7 +84,7 @@ impl From for Build { type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), Error>; impl Build { - /// Execute this `Init` command. + /// Execute this `Build` command. pub fn run(&mut self, log: &Logger, mode: BuildMode) -> Result<(), Error> { let process_steps = Build::get_process_steps(mode); @@ -148,7 +147,6 @@ impl Build { } } - fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(&log, "Checking crate configuration..."); manifest::check_crate_config(&self.crate_path, step)?; diff --git a/src/command/init.rs b/src/command/init.rs index f2bef530d..1fbb7af2e 100644 --- a/src/command/init.rs +++ b/src/command/init.rs @@ -1,6 +1,6 @@ //! Initializing a crate for packing `.wasm`s. -use command::utils::{set_crate_path,create_pkg_dir}; +use command::utils::{create_pkg_dir, set_crate_path}; use emoji; use error::Error; use indicatif::HumanDuration; @@ -17,8 +17,6 @@ pub struct Init { scope: Option, disable_dts: bool, target: String, - // build without --release. - debug: bool, } /// `Init` options @@ -39,22 +37,16 @@ pub struct InitOptions { #[structopt(long = "target", short = "t", default_value = "browser")] /// Sets the target environment. [possible values: browser, nodejs] pub target: String, - - #[structopt(long = "debug")] - /// Build without --release. - pub debug: bool, } impl From for Init { fn from(init_opts: InitOptions) -> Self { let crate_path = set_crate_path(init_opts.path); - let crate_name = manifest::get_crate_name(&crate_path).unwrap(); - Init { + Init { crate_path, scope: init_opts.scope, - disable_dts:init_opts.disable_dts, - target:init_opts.target, - debug:init_opts.debug, + disable_dts: init_opts.disable_dts, + target: init_opts.target, } } } diff --git a/src/command/mod.rs b/src/command/mod.rs index 513dd7a22..19ced9ad5 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -7,11 +7,11 @@ mod pack; mod publish; pub mod utils; +use self::build::{Build, BuildMode}; +use self::init::Init; use self::login::login; use self::pack::pack; use self::publish::publish; -use self::build::{Build,BuildMode}; -use self::init::Init; use error::Error; use slog::Logger; use std::result; diff --git a/src/command/utils.rs b/src/command/utils.rs index 650878ea1..e50ba4d0c 100644 --- a/src/command/utils.rs +++ b/src/command/utils.rs @@ -1,10 +1,10 @@ //! Utility functions for commands. +use emoji; use error::Error; use progressbar::Step; -use PBAR; use std::fs; -use emoji; +use PBAR; /// If an explicit path is given, then use it, otherwise assume the current /// directory is the crate path.