chore: Remove unused crates and error variants

master
Jesper Håkansson 7 years ago
parent 714a8a1581
commit 50e472de05
  1. 11
      Cargo.lock
  2. 11
      Cargo.toml
  3. 4
      binary-install/Cargo.toml
  4. 5
      binary-install/src/lib.rs
  5. 54
      src/error.rs
  6. 9
      src/lib.rs

11
Cargo.lock generated

@ -77,11 +77,7 @@ dependencies = [
"flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)",
"which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1066,11 +1062,7 @@ dependencies = [
"binary-install 0.1.0",
"cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1079,16 +1071,13 @@ dependencies = [
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
"siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"which 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]

@ -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"
@ -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]

@ -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"

@ -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};

@ -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)]
@ -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 {
@ -73,13 +63,6 @@ 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.
@ -87,13 +70,6 @@ pub enum Error {
/// Error message.
message: String,
},
#[fail(display = "{}", message)]
/// Error related to some HTTP request.
Http {
/// Error message.
message: String,
},
}
impl Error {
@ -114,13 +90,6 @@ 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 {
@ -128,13 +97,6 @@ impl Error {
}
}
/// 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 {
@ -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.",
@ -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()
}
}
@ -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)

@ -4,20 +4,16 @@
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]
@ -25,10 +21,7 @@ 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;

Loading…
Cancel
Save