summaryrefslogtreecommitdiffstats
path: root/bin/core/imag-tag/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/core/imag-tag/src/lib.rs')
-rw-r--r--bin/core/imag-tag/src/lib.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/bin/core/imag-tag/src/lib.rs b/bin/core/imag-tag/src/lib.rs
index df09ef54..f562c9a2 100644
--- a/bin/core/imag-tag/src/lib.rs
+++ b/bin/core/imag-tag/src/lib.rs
@@ -39,7 +39,7 @@ extern crate resiter;
#[macro_use] extern crate log;
#[cfg(test)] extern crate toml;
-#[macro_use] extern crate failure;
+#[macro_use] extern crate anyhow;
extern crate libimagstore;
extern crate libimagrt;
@@ -61,8 +61,8 @@ extern crate env_logger;
use std::io::Write;
-use failure::Fallible as Result;
-use failure::err_msg;
+use anyhow::Result;
+
use resiter::AndThen;
use resiter::Map;
use resiter::FilterMap;
@@ -119,7 +119,7 @@ impl ImagApplication for ImagTag {
iter.filter_map_ok(|id| {
match rt.store().get(id.clone()) {
Err(e) => Some(Err(e)),
- Ok(None) => Some(Err(format_err!("No entry for id {}", id))),
+ Ok(None) => Some(Err(anyhow!("No entry for id {}", id))),
Ok(Some(entry)) => {
let entry_tags = match entry.get_tags() {
Err(e) => return Some(Err(e)),
@@ -158,7 +158,7 @@ impl ImagApplication for ImagTag {
iter.filter_map_ok(|id| {
match rt.store().get(id.clone()) {
Err(e) => Some(Err(e)),
- Ok(None) => Some(Err(format_err!("No entry for id {}", id))),
+ Ok(None) => Some(Err(anyhow!("No entry for id {}", id))),
Ok(Some(entry)) => {
let entry_tags = match entry.get_tags() {
Err(e) => return Some(Err(e)),
@@ -197,7 +197,7 @@ impl ImagApplication for ImagTag {
if rt.handle_unknown_subcommand("imag-tag", other, rt.cli())?.success() {
Ok(())
} else {
- Err(format_err!("Subcommand failed"))
+ Err(anyhow!("Subcommand failed"))
}
},
}
@@ -261,7 +261,7 @@ fn alter(rt: &Runtime, path: StoreId, add: Option<Vec<Tag>>, rem: Option<Vec<Tag
}
fn list(path: StoreId, rt: &Runtime, has_subcommand: bool) -> Result<()> {
- let entry = rt.store().get(path.clone())?.ok_or_else(|| err_msg("No entry found"))?;
+ let entry = rt.store().get(path.clone())?.ok_or_else(|| anyhow!("No entry found"))?;
let (scmd, json_out, line_out, sepp_out, mut comm_out) = if has_subcommand {
let scmd = rt.cli().subcommand_matches("list").unwrap();
let json_out = scmd.is_present("json");
@@ -320,7 +320,7 @@ fn get_remove_tags(matches: &ArgMatches) -> Result<Option<Vec<Tag>>> {
fn retrieve_tags(m: &ArgMatches, s: &'static str, v: &'static str) -> Result<Option<Vec<Tag>>> {
Ok(Some(m
.subcommand_matches(s)
- .ok_or_else(|| format_err!("Expected subcommand '{}', but was not specified", s))?
+ .ok_or_else(|| anyhow!("Expected subcommand '{}', but was not specified", s))?
.values_of(v)
.unwrap() // enforced by clap
.map(String::from)
@@ -334,8 +334,8 @@ mod tests {
use toml::value::Value;
use toml_query::read::TomlValueReadExt;
- use failure::Fallible as Result;
- use failure::Error;
+ use anyhow::Result;
+ use anyhow::Error;
use libimagrt::runtime::Runtime;
use libimagstore::storeid::StoreId;