Skip to content

Commit 553fbad

Browse files
committed
Update the Error type.
This remove the InvalidSet variant, which is no longer used, and no longer exposes the `regex_syntax::Error` type, instead exposing it as a string.
1 parent 17c0f3c commit 553fbad

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/error.rs

+4-18
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@ use syntax;
1616
#[derive(Debug)]
1717
pub enum Error {
1818
/// A syntax error.
19-
Syntax(syntax::Error),
19+
Syntax(String),
2020
/// The compiled program exceeded the set size limit.
2121
/// The argument is the size limit imposed.
2222
CompiledTooBig(usize),
23-
/// **DEPRECATED:** Will be removed on next major version bump.
24-
///
25-
/// This error is no longer used. (A `RegexSet` can now contain zero or
26-
/// more regular expressions.)
27-
InvalidSet,
2823
/// Hints that destructuring should not be exhaustive.
2924
///
3025
/// This enum may grow additional variants, so this makes sure clients
@@ -37,20 +32,14 @@ pub enum Error {
3732
impl ::std::error::Error for Error {
3833
fn description(&self) -> &str {
3934
match *self {
40-
Error::Syntax(ref err) => err.description(),
35+
Error::Syntax(ref err) => err,
4136
Error::CompiledTooBig(_) => "compiled program too big",
42-
Error::InvalidSet => {
43-
"sets must contain 2 or more regular expressions"
44-
}
4537
Error::__Nonexhaustive => unreachable!(),
4638
}
4739
}
4840

4941
fn cause(&self) -> Option<&::std::error::Error> {
50-
match *self {
51-
Error::Syntax(ref err) => Some(err),
52-
_ => None,
53-
}
42+
None
5443
}
5544
}
5645

@@ -62,16 +51,13 @@ impl fmt::Display for Error {
6251
write!(f, "Compiled regex exceeds size limit of {} bytes.",
6352
limit)
6453
}
65-
Error::InvalidSet => {
66-
write!(f, "Sets must contain 2 or more regular expressions.")
67-
}
6854
Error::__Nonexhaustive => unreachable!(),
6955
}
7056
}
7157
}
7258

7359
impl From<syntax::Error> for Error {
7460
fn from(err: syntax::Error) -> Error {
75-
Error::Syntax(err)
61+
Error::Syntax(err.to_string())
7662
}
7763
}

0 commit comments

Comments
 (0)