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

Commit

Permalink
Migrate from failure to anyhow
Browse files Browse the repository at this point in the history
This moves from a custom error trait to the standard `Error` trait,
improving ecosystem interoperability.
  • Loading branch information
alexcrichton committed Jan 7, 2020
1 parent e7241b3 commit 5553ac4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exclude = [
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
failure = "0.1.2"
anyhow = "1.0.0"
log = "0.4.1"

[dev-dependencies]
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#[macro_use]
extern crate log;
#[macro_use]
extern crate failure;
#[cfg(test)]
#[macro_use]
extern crate proptest;
Expand All @@ -12,7 +10,7 @@ use serde_json;
use std::collections::HashSet;
use std::ops::Range;

use failure::Error;
use anyhow::Error;

pub mod diagnostics;
use crate::diagnostics::{Diagnostic, DiagnosticSpan};
Expand Down
4 changes: 2 additions & 2 deletions src/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! replacement of parts of its content, with the ability to prevent changing
//! the same parts multiple times.
use failure::Error;
use anyhow::{Error, ensure, anyhow};
use std::rc::Rc;

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Data {
);
}

format_err!(
anyhow!(
"Could not replace range {}...{} in file \
-- maybe parts of it were already replaced?",
from,
Expand Down

0 comments on commit 5553ac4

Please sign in to comment.