Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 5553ac4

Browse files
committed
Migrate from failure to anyhow
This moves from a custom error trait to the standard `Error` trait, improving ecosystem interoperability.
1 parent e7241b3 commit 5553ac4

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exclude = [
2020
[dependencies]
2121
serde = { version = "1.0", features = ["derive"] }
2222
serde_json = "1.0"
23-
failure = "0.1.2"
23+
anyhow = "1.0.0"
2424
log = "0.4.1"
2525

2626
[dev-dependencies]

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#[macro_use]
44
extern crate log;
5-
#[macro_use]
6-
extern crate failure;
75
#[cfg(test)]
86
#[macro_use]
97
extern crate proptest;
@@ -12,7 +10,7 @@ use serde_json;
1210
use std::collections::HashSet;
1311
use std::ops::Range;
1412

15-
use failure::Error;
13+
use anyhow::Error;
1614

1715
pub mod diagnostics;
1816
use crate::diagnostics::{Diagnostic, DiagnosticSpan};

src/replace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! replacement of parts of its content, with the ability to prevent changing
33
//! the same parts multiple times.
44
5-
use failure::Error;
5+
use anyhow::{Error, ensure, anyhow};
66
use std::rc::Rc;
77

88
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -133,7 +133,7 @@ impl Data {
133133
);
134134
}
135135

136-
format_err!(
136+
anyhow!(
137137
"Could not replace range {}...{} in file \
138138
-- maybe parts of it were already replaced?",
139139
from,

0 commit comments

Comments
 (0)