Allow a trailing comma in assert_eq/ne macro
This commit is contained in:
parent
fd9ecfdfd0
commit
6a92c0fdbd
5 changed files with 6 additions and 16 deletions
|
@ -120,6 +120,9 @@ macro_rules! assert_eq {
|
|||
}
|
||||
}
|
||||
});
|
||||
($left:expr, $right:expr,) => ({
|
||||
assert_eq!($left, $right)
|
||||
});
|
||||
($left:expr, $right:expr, $($arg:tt)+) => ({
|
||||
match (&($left), &($right)) {
|
||||
(left_val, right_val) => {
|
||||
|
@ -168,6 +171,9 @@ macro_rules! assert_ne {
|
|||
}
|
||||
}
|
||||
});
|
||||
($left:expr, $right:expr,) => {
|
||||
assert_ne!($left, $right)
|
||||
};
|
||||
($left:expr, $right:expr, $($arg:tt)+) => ({
|
||||
match (&($left), &($right)) {
|
||||
(left_val, right_val) => {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
error: unexpected end of macro invocation
|
||||
--> $DIR/assert_eq_trailing_comma.rs:12:20
|
||||
|
|
||||
12 | assert_eq!(1, 1,);
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
error: unexpected end of macro invocation
|
||||
--> $DIR/assert_ne_trailing_comma.rs:12:20
|
||||
|
|
||||
12 | assert_ne!(1, 2,);
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in a new issue