From bd2d4486c193eaf20cdd91f79b3de8f6c8843e6d Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy <mmstick@pm.me> Date: Wed, 27 Mar 2019 21:10:17 -0600 Subject: [PATCH] :recycle: Replace failure-derive with err-derive --- Cargo.lock | 86 +++++++++++++------------------- Cargo.toml | 3 +- Makefile | 4 +- debian/rules | 7 ++- manual/src/control/03-matches.md | 2 + src/lib/lib.rs | 16 +----- src/lib/shell/mod.rs | 10 ++-- src/main.rs | 4 -- 8 files changed, 49 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21033df3..7ff65ec2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,28 +37,6 @@ name = "autocfg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "backtrace" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bitflags" version = "1.0.4" @@ -223,32 +201,24 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "errno-dragonfly" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure" +name = "err-derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "failure_derive" -version = "0.1.5" +name = "errno-dragonfly" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -298,8 +268,7 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "calculate 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,14 +590,17 @@ dependencies = [ ] [[package]] -name = "rustc-demangle" -version = "0.1.13" +name = "rustc-serialize" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc-serialize" -version = "0.3.24" +name = "rustc_version" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "ryu" @@ -648,6 +620,19 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "1.0.89" @@ -839,8 +824,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" @@ -859,9 +842,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5cdef62f37e6ffe7d1f07a381bc0db32b7a3ff1cac0de56cb0d81e71f53d65" "checksum decimal 2.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e6458723bc760383275fbc02f4c769b2e5f3de782abaf5e7e0b9b7f0368a63ed" "checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac" +"checksum err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3d8ff65eb6c2fc68e76557239d16f5698fd56603925b89856d3f0f7105fd4543" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0a7292d30132fb5424b354f5dc02512a86e4c516fe544bb7a25e7f266951b797" @@ -900,11 +882,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53ee8cfdddb2e0291adfb9f13d31d3bbe0a03c9a402c01b1e24188d86c35b24f" "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" "checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" diff --git a/Cargo.toml b/Cargo.toml index 2cc63c45..97dd04fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,8 +43,7 @@ version_check = "0.1.3" [dependencies] bitflags = "1.0" calculate = "0.5" -failure = "0.1" -failure_derive = "0.1" +err-derive = "0.1" glob = "0.2" itoa = "0.4" lazy_static = "1.0" diff --git a/Makefile b/Makefile index 4cad4f96..699f3dd2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -PREFIX ?= usr/local -BINARY = $(PREFIX)/bin/ion +prefix ?= usr/local +BINARY = $(prefix)/bin/ion RELEASE = debug TOOLCHAIN ?= 1.31.0 diff --git a/debian/rules b/debian/rules index 2f497b59..9ff4894d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,6 @@ #!/usr/bin/make -f export RUSTUP = 0 -export PREFIX = /usr # When building packages locally, `env VENDORED=0 CLEAN=0 debuild` # will build a package using non-vendored dependencies, and @@ -12,7 +11,7 @@ export VENDORED ?= 1 CLEAN ?= 1 %: - dh $@ --with=systemd + dh $@ override_dh_auto_clean: ifeq ($(CLEAN),1) @@ -25,5 +24,5 @@ ifeq ($(VENDORED),1) fi endif -override_dh_auto_build: - dh_auto_build +override_dh_auto_install: + dh_auto_install -- prefix=/usr diff --git a/manual/src/control/03-matches.md b/manual/src/control/03-matches.md index 906241ff..d16d6787 100644 --- a/manual/src/control/03-matches.md +++ b/manual/src/control/03-matches.md @@ -39,6 +39,8 @@ match [ five foo bar ] end ``` +## Match guards + Match guards can be added to a match to employ an additional test ```sh diff --git a/src/lib/lib.rs b/src/lib/lib.rs index a6581a95..1e9f41d1 100644 --- a/src/lib/lib.rs +++ b/src/lib/lib.rs @@ -2,25 +2,11 @@ #[macro_use] extern crate bitflags; -extern crate calc; -extern crate failure; #[macro_use] -extern crate failure_derive; -extern crate glob; -extern crate hashbrown; -extern crate itertools; -extern crate itoa; +extern crate err_derive; #[macro_use] extern crate lazy_static; -extern crate liner; -extern crate regex; -extern crate small; -extern crate smallvec; -extern crate unicode_segmentation; -extern crate xdg; - extern crate ion_braces as braces; -extern crate ion_builtins; extern crate ion_lexers as lexers; extern crate ion_ranges as ranges; extern crate ion_sys as sys; diff --git a/src/lib/shell/mod.rs b/src/lib/shell/mod.rs index facb5f7c..2865aca8 100644 --- a/src/lib/shell/mod.rs +++ b/src/lib/shell/mod.rs @@ -71,15 +71,15 @@ use std::{ }; use xdg::BaseDirectories; -#[derive(Debug, Fail)] +#[derive(Debug, Error)] pub enum IonError { - #[fail(display = "failed to fork: {}", why)] + #[error(display = "failed to fork: {}", why)] Fork { why: io::Error }, - #[fail(display = "element does not exist")] + #[error(display = "element does not exist")] DoesNotExist, - #[fail(display = "input was not terminated")] + #[error(display = "input was not terminated")] Unterminated, - #[fail(display = "function error: {}", why)] + #[error(display = "function error: {}", why)] Function { why: FunctionError }, } diff --git a/src/main.rs b/src/main.rs index bf19a9f3..64bb135d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,4 @@ -extern crate getopts; -extern crate ion_shell; extern crate ion_sys as sys; -extern crate small; -extern crate smallvec; use getopts::Options; use ion_shell::{flags::NO_EXEC, Binary, JobControl, ShellBuilder, MAN_ION}; -- GitLab