diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-03-07 16:04:33 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-03-08 11:43:24 +0100 |
commit | 8527d447ae2047e0d5d54cc70599a895b62a3ee0 (patch) | |
tree | 023de5d446d28c6a232308f8604e17a129ee49c7 /bin/domain/imag-diary/src/delete.rs | |
parent | 00aa4df88edae1d5eeb3fb365af05f95bd0de3b4 (diff) |
Replace failure with anyhow in complete codebase
This patch was scripted with
sed -i 's/use failure::Error/use anyhow::Error/' $(rg "use failure::Error" -l)
sed -i 's/use failure::Fallible as /use anyhow::/' $(rg "use failure::Fallible" -l)
sed -i 's/failure/anyhow/' $(rg "failure *=" -l)
sed -i 's/format_err!/anyhow!/' $(rg "format_err!" -l)
sed -i 's/use failure::ResultExt/use anyhow::Context/' $(rg "use failure::ResultExt" -l)
sed -i 's/err_msg/anyhow!/' $(rg "use failure::err_msg" -l)
sed -i 's/^anyhow\ *=.*$/anyhow = "1"/' $(rg "anyhow * =" -l)
sed -i 's/^anyhow_derive.*//' $(rg "anyhow_derive" -l)
sed -i 's/extern crate failure/extern crate anyhow/' $(rg "extern crate failure" -l)
sed -i 's/.*extern crate anyhow_derive.*//' $(rg "anyhow_derive" -l)
Some manual changes were added as well, so this patch was not completely
scripted, but mostly.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin/domain/imag-diary/src/delete.rs')
-rw-r--r-- | bin/domain/imag-diary/src/delete.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/domain/imag-diary/src/delete.rs b/bin/domain/imag-diary/src/delete.rs index 0f313989..d80ac6d5 100644 --- a/bin/domain/imag-diary/src/delete.rs +++ b/bin/domain/imag-diary/src/delete.rs @@ -18,8 +18,8 @@ // use chrono::naive::NaiveDateTime as NDT; -use failure::Fallible as Result; -use failure::err_msg; +use anyhow::Result; + use libimagdiary::diaryid::DiaryId; use libimagrt::runtime::Runtime; @@ -33,7 +33,7 @@ pub fn delete(rt: &Runtime) -> Result<()> { use libimaginteraction::ask::ask_bool; let diaryname = get_diary_name(rt) - .ok_or_else(|| err_msg("No diary selected. Use either the configuration file or the commandline option"))?; + .ok_or_else(|| anyhow!("No diary selected. Use either the configuration file or the commandline option"))?; let to_del_location = rt .cli() @@ -43,13 +43,13 @@ pub fn delete(rt: &Runtime) -> Result<()> { .map(|dt| { debug!("DateTime = {:?}", dt); dt }) .and_then(DateTime::parse) .map(Into::into) - .ok_or_else(|| err_msg("Not deleting entries: missing date/time specification")) + .ok_or_else(|| anyhow!("Not deleting entries: missing date/time specification")) .and_then(|dt: NDT| DiaryId::from_datetime(diaryname.clone(), dt).into_storeid()) .and_then(|id| rt.store().retrieve(id))? .get_location() .clone(); - let mut input = rt.stdin().ok_or_else(|| err_msg("No input stream. Cannot ask for permission"))?; + let mut input = rt.stdin().ok_or_else(|| anyhow!("No input stream. Cannot ask for permission"))?; let mut output = rt.stdout(); if !ask_bool(&format!("Deleting {:?}", to_del_location), Some(true), &mut input, &mut output)? { |