Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe committed Jul 16, 2018
1 parent 4eb1ac3 commit 24dac77
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
16 changes: 7 additions & 9 deletions src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String>,
Expand All @@ -60,7 +60,6 @@ pub struct BuildOptions {
#[structopt(long = "debug")]
/// Build without --release.
debug: bool,

// build config from manifest
// build_config: Option<BuildConfig>,
}
Expand All @@ -72,10 +71,10 @@ impl From<BuildOptions> 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,
}
Expand All @@ -85,7 +84,7 @@ impl From<BuildOptions> 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);

Expand Down Expand Up @@ -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)?;
Expand Down
16 changes: 4 additions & 12 deletions src/command/init.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,8 +17,6 @@ pub struct Init {
scope: Option<String>,
disable_dts: bool,
target: String,
// build without --release.
debug: bool,
}

/// `Init` options
Expand All @@ -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<InitOptions> 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,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/command/utils.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 24dac77

Please sign in to comment.