Skip to content

Commit 07b493d

Browse files
committed
cmd(init/build): cargo fmt
1 parent 9d17ba4 commit 07b493d

File tree

4 files changed

+15
-27
lines changed

4 files changed

+15
-27
lines changed

src/command/build.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
//! Initializing a crate for packing `.wasm`s.
2-
31
use bindgen;
42
use build;
5-
use command::utils::{set_crate_path, create_pkg_dir};
3+
use command::utils::{create_pkg_dir, set_crate_path};
64
use emoji;
75
use error::Error;
86
use indicatif::HumanDuration;
@@ -35,7 +33,7 @@ pub enum BuildMode {
3533
}
3634

3735
/// Everything required to configure and run the `wasm-pack build` command.
38-
#[derive(Debug,StructOpt)]
36+
#[derive(Debug, StructOpt)]
3937
pub struct BuildOptions {
4038
/// The path to the Rust crate.
4139
pub path: Option<String>,
@@ -60,7 +58,6 @@ pub struct BuildOptions {
6058
#[structopt(long = "debug")]
6159
/// Build without --release.
6260
debug: bool,
63-
6461
// build config from manifest
6562
// build_config: Option<BuildConfig>,
6663
}
@@ -72,10 +69,10 @@ impl From<BuildOptions> for Build {
7269
// let build_config = manifest::xxx(&crate_path).xxx();
7370
Build {
7471
crate_path,
75-
scope:build_opts.scope,
76-
disable_dts:build_opts.disable_dts,
77-
target:build_opts.target,
78-
debug:build_opts.debug,
72+
scope: build_opts.scope,
73+
disable_dts: build_opts.disable_dts,
74+
target: build_opts.target,
75+
debug: build_opts.debug,
7976
// build_config,
8077
crate_name,
8178
}
@@ -85,7 +82,7 @@ impl From<BuildOptions> for Build {
8582
type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), Error>;
8683

8784
impl Build {
88-
/// Execute this `Init` command.
85+
/// Execute this `Build` command.
8986
pub fn run(&mut self, log: &Logger, mode: BuildMode) -> Result<(), Error> {
9087
let process_steps = Build::get_process_steps(mode);
9188

@@ -148,7 +145,6 @@ impl Build {
148145
}
149146
}
150147

151-
152148
fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> {
153149
info!(&log, "Checking crate configuration...");
154150
manifest::check_crate_config(&self.crate_path, step)?;

src/command/init.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Initializing a crate for packing `.wasm`s.
22
3-
use command::utils::{set_crate_path,create_pkg_dir};
3+
use command::utils::{create_pkg_dir, set_crate_path};
44
use emoji;
55
use error::Error;
66
use indicatif::HumanDuration;
@@ -17,8 +17,6 @@ pub struct Init {
1717
scope: Option<String>,
1818
disable_dts: bool,
1919
target: String,
20-
// build without --release.
21-
debug: bool,
2220
}
2321

2422
/// `Init` options
@@ -39,22 +37,16 @@ pub struct InitOptions {
3937
#[structopt(long = "target", short = "t", default_value = "browser")]
4038
/// Sets the target environment. [possible values: browser, nodejs]
4139
pub target: String,
42-
43-
#[structopt(long = "debug")]
44-
/// Build without --release.
45-
pub debug: bool,
4640
}
4741

4842
impl From<InitOptions> for Init {
4943
fn from(init_opts: InitOptions) -> Self {
5044
let crate_path = set_crate_path(init_opts.path);
51-
let crate_name = manifest::get_crate_name(&crate_path).unwrap();
52-
Init {
45+
Init {
5346
crate_path,
5447
scope: init_opts.scope,
55-
disable_dts:init_opts.disable_dts,
56-
target:init_opts.target,
57-
debug:init_opts.debug,
48+
disable_dts: init_opts.disable_dts,
49+
target: init_opts.target,
5850
}
5951
}
6052
}

src/command/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ mod pack;
77
mod publish;
88
pub mod utils;
99

10+
use self::build::{Build, BuildMode};
11+
use self::init::Init;
1012
use self::login::login;
1113
use self::pack::pack;
1214
use self::publish::publish;
13-
use self::build::{Build,BuildMode};
14-
use self::init::Init;
1515
use error::Error;
1616
use slog::Logger;
1717
use std::result;

src/command/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
//! Utility functions for commands.
22
3+
use emoji;
34
use error::Error;
45
use progressbar::Step;
5-
use PBAR;
66
use std::fs;
7-
use emoji;
7+
use PBAR;
88

99
/// If an explicit path is given, then use it, otherwise assume the current
1010
/// directory is the crate path.

0 commit comments

Comments
 (0)