From 8527d447ae2047e0d5d54cc70599a895b62a3ee0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 7 Mar 2020 16:04:33 +0100 Subject: 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 --- bin/domain/imag-calendar/src/filters.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bin/domain/imag-calendar/src/filters.rs') diff --git a/bin/domain/imag-calendar/src/filters.rs b/bin/domain/imag-calendar/src/filters.rs index 7e452e94..d57d2129 100644 --- a/bin/domain/imag-calendar/src/filters.rs +++ b/bin/domain/imag-calendar/src/filters.rs @@ -18,7 +18,7 @@ // use chrono::NaiveDateTime; -use failure::Fallible as Result; +use anyhow::Result; use vobject::icalendar::Event; use libimagerror::trace::MapErrTrace; @@ -35,7 +35,7 @@ pub fn event_is_before<'a>(event: &Event<'a>, before_spec: &NaiveDateTime) -> bo Ok(result) }) .unwrap_or_else(|| Err({ - format_err!("Entry with UID {} has no end time, cannot determine whether to list it", + anyhow!("Entry with UID {} has no end time, cannot determine whether to list it", uid()) })); @@ -47,7 +47,7 @@ pub fn event_is_before<'a>(event: &Event<'a>, before_spec: &NaiveDateTime) -> bo Ok(result) }) .unwrap_or_else(|| Err({ - format_err!("Entry with UID {} has no timestamp, cannot determine whether to list it", + anyhow!("Entry with UID {} has no timestamp, cannot determine whether to list it", uid()) })); @@ -72,6 +72,6 @@ fn try_to_parse_datetime(s: &str) -> Result { ]; ::libimagutil::date::try_to_parse_datetime_from_string(s, FORMATS.iter()) - .ok_or_else(|| format_err!("Cannot parse datetime: {}", s)) + .ok_or_else(|| anyhow!("Cannot parse datetime: {}", s)) } -- cgit v1.2.3