@@ -3,19 +3,13 @@ use std::iter::repeat;
3
3
4
4
/// An error that occurred during parsing or compiling a regular expression.
5
5
#[ derive( Clone , PartialEq ) ]
6
+ #[ non_exhaustive]
6
7
pub enum Error {
7
8
/// A syntax error.
8
9
Syntax ( String ) ,
9
10
/// The compiled program exceeded the set size limit.
10
11
/// The argument is the size limit imposed.
11
12
CompiledTooBig ( usize ) ,
12
- /// Hints that destructuring should not be exhaustive.
13
- ///
14
- /// This enum may grow additional variants, so this makes sure clients
15
- /// don't count on exhaustive matching. (Otherwise, adding a new variant
16
- /// could break existing code.)
17
- #[ doc( hidden) ]
18
- __Nonexhaustive,
19
13
}
20
14
21
15
impl :: std:: error:: Error for Error {
@@ -25,7 +19,6 @@ impl ::std::error::Error for Error {
25
19
match * self {
26
20
Error :: Syntax ( ref err) => err,
27
21
Error :: CompiledTooBig ( _) => "compiled program too big" ,
28
- Error :: __Nonexhaustive => unreachable ! ( ) ,
29
22
}
30
23
}
31
24
}
@@ -39,7 +32,6 @@ impl fmt::Display for Error {
39
32
"Compiled regex exceeds size limit of {} bytes." ,
40
33
limit
41
34
) ,
42
- Error :: __Nonexhaustive => unreachable ! ( ) ,
43
35
}
44
36
}
45
37
}
@@ -63,9 +55,6 @@ impl fmt::Debug for Error {
63
55
Error :: CompiledTooBig ( limit) => {
64
56
f. debug_tuple ( "CompiledTooBig" ) . field ( & limit) . finish ( )
65
57
}
66
- Error :: __Nonexhaustive => {
67
- f. debug_tuple ( "__Nonexhaustive" ) . finish ( )
68
- }
69
58
}
70
59
}
71
60
}
0 commit comments