Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
chore: Remove unused crates and error variants
Browse files Browse the repository at this point in the history
  • Loading branch information
drager committed Nov 6, 2018
1 parent 714a8a1 commit 50e472d
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 92 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@ readme = "README.md"
categories = ["wasm"]
documentation = "https://rustwasm.github.io/wasm-pack/"

[workspace]
members = ["binary-install"]
exclude = ["target"]

[dependencies]
atty = "0.2.11"
cargo_metadata = "0.6.0"
console = "0.6.1"
curl = "0.4.13"
dirs = "1.0.4"
failure = "0.1.2"
flate2 = "1.0.2"
hex = "0.3"
human-panic = "1.0.1"
indicatif = "0.9.0"
lazy_static = "1.1.0"
Expand All @@ -30,15 +22,12 @@ parking_lot = "0.6"
serde = "1.0.74"
serde_derive = "1.0.74"
serde_json = "1.0.26"
siphasher = "0.2.3"
slog = "2.3"
slog-term = "2.4"
slog-async = "2.3"
structopt = "0.2"
tar = "0.4.16"
toml = "0.4"
which = "2.0.0"
zip = "0.4.2"
binary-install = { version = "0.1.0", path = "./binary-install" }

[dev-dependencies]
Expand Down
4 changes: 0 additions & 4 deletions binary-install/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ failure = "0.1.2"
flate2 = "1.0.2"
hex = "0.3"
siphasher = "0.2.3"
slog = "2.3"
slog-term = "2.4"
slog-async = "2.3"
tar = "0.4.16"
which = "2.0.0"
zip = "0.4.2"
5 changes: 1 addition & 4 deletions binary-install/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
extern crate curl;
#[macro_use]
extern crate failure;
extern crate flate2;
#[macro_use]
extern crate slog;
extern crate dirs;
extern crate flate2;
extern crate hex;
extern crate siphasher;
extern crate tar;
extern crate which;
extern crate zip;

use failure::{Error, ResultExt};
Expand Down
54 changes: 0 additions & 54 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! Code related to error handling for wasm-pack
use curl;
use serde_json;
use std::borrow::Cow;
use std::io;
use std::process::ExitStatus;
use toml;
use zip;

/// Errors that can potentially occur in `wasm-pack`.
#[derive(Debug, Fail)]
Expand All @@ -22,14 +20,6 @@ pub enum Error {
#[fail(display = "{}", _0)]
SerdeToml(#[cause] toml::de::Error),

#[fail(display = "{}", _0)]
/// A curl error.
Curl(#[cause] curl::Error),

#[fail(display = "{}", _0)]
/// An error handling zip archives.
Zip(#[cause] zip::result::ZipError),

#[fail(display = "{}", _0)]
/// An error in parsing your rustc version.
RustcMissing {
Expand Down Expand Up @@ -73,27 +63,13 @@ pub enum Error {
message: String,
},

#[fail(display = "{}", message)]
/// An error related to an archive that we downloaded.
Archive {
/// Error message.
message: String,
},

#[fail(display = "{}", message)]
/// Error when some operation or feature is unsupported for the current
/// target or environment.
Unsupported {
/// Error message.
message: String,
},

#[fail(display = "{}", message)]
/// Error related to some HTTP request.
Http {
/// Error message.
message: String,
},
}

impl Error {
Expand All @@ -114,27 +90,13 @@ impl Error {
}
}

/// Construct an archive error.
pub fn archive(message: &str) -> Self {
Error::Archive {
message: message.to_string(),
}
}

/// Construct an unsupported error.
pub fn unsupported(message: &str) -> Self {
Error::Unsupported {
message: message.to_string(),
}
}

/// Construct an http error.
pub fn http(message: &str) -> Self {
Error::Http {
message: message.to_string(),
}
}

/// Construct a rustc version error.
pub fn rustc_version_error(message: &str, local_version: &str) -> Self {
Error::RustcVersion {
Expand All @@ -149,7 +111,6 @@ impl Error {
Error::Io(_) => "There was an I/O error. Details:\n\n",
Error::SerdeJson(_) => "There was an JSON error. Details:\n\n",
Error::SerdeToml(_) => "There was an TOML error. Details:\n\n",
Error::Zip(_) => "There was an error handling zip files. Details:\n\n",
Error::RustcMissing {
message: _,
} => "We can't figure out what your Rust version is- which means you might not have Rust installed. Please install Rust version 1.30.0 or higher.",
Expand All @@ -169,10 +130,7 @@ impl Error {
Error::PkgNotFound {
message: _,
} => "Unable to find the 'pkg' directory at the path, set the path as the parent of the 'pkg' directory \n\n",
Error::Curl(_) => "There was an error making an HTTP request with curl. Details:\n\n",
Error::Archive {..} => "There was an error related to an archive file. Details:\n\n",
Error::Unsupported {..} => "There was an unsupported operation attempted. Details:\n\n",
Error::Http {..} => "There wasn an HTTP error. Details:\n\n",
}.to_string()
}
}
Expand All @@ -183,24 +141,12 @@ impl From<io::Error> for Error {
}
}

impl From<curl::Error> for Error {
fn from(e: curl::Error) -> Self {
Error::Curl(e)
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::SerdeJson(e)
}
}

impl From<zip::result::ZipError> for Error {
fn from(e: zip::result::ZipError) -> Self {
Error::Zip(e)
}
}

impl From<toml::de::Error> for Error {
fn from(e: toml::de::Error) -> Self {
Error::SerdeToml(e)
Expand Down
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,24 @@

extern crate cargo_metadata;
extern crate console;
extern crate curl;
extern crate dirs;
#[macro_use]
extern crate failure;
extern crate flate2;
extern crate hex;
extern crate indicatif;
extern crate which;
#[macro_use]
extern crate lazy_static;
extern crate parking_lot;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate siphasher;
#[macro_use]
extern crate structopt;
#[macro_use]
extern crate slog;
extern crate binary_install;
extern crate slog_async;
extern crate slog_term;
extern crate tar;
extern crate toml;
extern crate which;
extern crate zip;

pub mod bindgen;
pub mod build;
Expand Down

0 comments on commit 50e472d

Please sign in to comment.