@@ -39,12 +39,7 @@ macro_rules! throw_validation_failure {
39
39
/// Returns a validation failure for any Err value of $e.
40
40
macro_rules! try_validation {
41
41
( $e: expr, $what: expr, $where: expr $( , $details: expr ) ?) => { {
42
- match $e {
43
- Ok ( x) => x,
44
- // We catch the error and turn it into a validation failure. We are okay with
45
- // allocation here as this can only slow down builds that fail anyway.
46
- Err ( _) => throw_validation_failure!( $what, $where $( , $details) ?) ,
47
- }
42
+ try_validation_pat!( $e, _, $what, $where $( , $details ) ?)
48
43
} } ;
49
44
}
50
45
/// Like try_validation, but will throw a validation error if any of the patterns in $p are
@@ -60,6 +55,8 @@ macro_rules! try_validation_pat {
60
55
( $e: expr, $( $p: pat ) |* , $what: expr, $where: expr $( , $details: expr ) ?) => { {
61
56
match $e {
62
57
Ok ( x) => x,
58
+ // We catch the error and turn it into a validation failure. We are okay with
59
+ // allocation here as this can only slow down builds that fail anyway.
63
60
$( Err ( $p) ) |* if true => throw_validation_failure!( $what, $where $( , $details) ?) ,
64
61
Err ( e) => Err :: <!, _>( e) ?,
65
62
}
0 commit comments