Move from err-derive to thiserror

This commit is contained in:
Dirkjan Ochtman 2020-11-23 13:23:16 +01:00
parent e5e46d6c1b
commit 1b4377715f
2 changed files with 7 additions and 7 deletions

View File

@ -11,7 +11,7 @@ documentation = "https://docs.rs/word-segmenters"
[dependencies]
ahash = "0.5.7"
err-derive = "0.2.4"
thiserror = "1.0.22"
[dev-dependencies]
bencher = "0.1.5"

View File

@ -8,7 +8,7 @@ use std::{
};
use ahash::AHashMap as HashMap;
use err_derive::Error;
use thiserror::Error;
pub struct Segmenter {
unigrams: HashMap<String, f64>,
@ -246,11 +246,11 @@ fn clean(s: &str) -> String {
#[derive(Debug, Error)]
pub enum ParseError {
#[error(display = "I/O error: {}", _0)]
Io(#[source] io::Error),
#[error(display = "integer parsing error: {}", _0)]
ParseInt(#[source] ParseIntError),
#[error(display = "{}", _0)]
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("integer parsing error: {0}")]
ParseInt(#[from] ParseIntError),
#[error("{0}")]
String(String),
}