Skip to content

Commit

Permalink
cargo fmt + ci fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile committed Jun 10, 2023
1 parent 1f75f15 commit 6329507
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/command/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use crate::wasm_opt;
use crate::PBAR;
use anyhow::{anyhow, bail, Error, Result};
use binary_install::Cache;
use clap::Args;
use log::info;
use std::fmt;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use clap::{Args};

/// Everything required to configure and run the `wasm-pack build` command.
#[allow(missing_docs)]
Expand Down
4 changes: 2 additions & 2 deletions src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use self::publish::{access::Access, publish};
use self::test::{Test, TestOptions};
use crate::install::InstallMode;
use anyhow::Result;
use clap::builder::ValueParser;
use clap::Subcommand;
use log::info;
use std::path::PathBuf;
use clap::Subcommand;
use clap::builder::ValueParser;
/// The various kinds of commands that `wasm-pack` can execute.
#[derive(Debug, Subcommand)]
pub enum Command {
Expand Down
4 changes: 2 additions & 2 deletions src/command/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use crate::manifest;
use crate::test::{self, webdriver};
use anyhow::{bail, Result};
use binary_install::Cache;
use clap::builder::ValueParser;
use clap::Args;
use console::style;
use log::info;
use std::path::PathBuf;
use std::str::FromStr;
use std::time::Instant;
use clap::Args;
use clap::builder::ValueParser;

#[derive(Debug, Default, Args)]
#[command(allow_hyphen_values = true, trailing_var_arg = true)]
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ extern crate strsim;
extern crate which;
#[macro_use]
extern crate serde_derive;
extern crate serde_ignored;
extern crate serde_json;
extern crate binary_install;
extern crate chrono;
extern crate dialoguer;
extern crate log;
extern crate serde_ignored;
extern crate serde_json;
extern crate toml;
extern crate walkdir;

Expand All @@ -41,9 +41,9 @@ pub mod target;
pub mod test;
pub mod wasm_opt;

use clap::Parser;
use clap::builder::ArgAction;
use crate::progressbar::{LogLevel, ProgressOutput};
use clap::builder::ArgAction;
use clap::Parser;

/// The global progress bar and user-facing message output.
pub static PBAR: ProgressOutput = ProgressOutput::new();
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

extern crate anyhow;
extern crate atty;
extern crate clap;
extern crate env_logger;
extern crate human_panic;
extern crate log;
extern crate clap;
extern crate wasm_pack;
extern crate which;

use anyhow::Result;
use clap::Parser;
use std::env;
use std::panic;
use std::sync::mpsc;
use std::thread;
use clap::Parser;
use wasm_pack::{
build::{self, WasmPackVersion},
command::run_wasm_pack,
Expand Down
19 changes: 12 additions & 7 deletions src/readme.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Generating `README` files for the packaged wasm.

use anyhow::{Context, Result};
use anyhow::{bail, Context, Result};
use std::fs;
use std::path::Path;

Expand All @@ -18,16 +18,21 @@ pub fn copy_from_crate(crate_data: &CrateData, path: &Path, out_dir: &Path) -> R
"crate's pkg directory should exist"
);

let crate_readme_path = match crate_data.crate_readme() {
None => return Ok(()),
let crate_readme_path = match dbg!(crate_data.crate_readme()) {
None => {
PBAR.warn("origin crate has no README");
return Ok(());
}
Some(readme_path) => path.join(readme_path),
};

let new_readme_path = out_dir.join("README.md");
if crate_readme_path.exists() {
fs::copy(&crate_readme_path, &new_readme_path).context("failed to copy README")?;
} else {
PBAR.warn("origin crate has no README");
if !(crate_readme_path.exists()) {
bail!(
"crate's README does not exist at {}",
crate_readme_path.display()
)
}
fs::copy(&crate_readme_path, &new_readme_path).context("failed to copy README")?;
Ok(())
}

0 comments on commit 6329507

Please sign in to comment.