Skip to content

Commit

Permalink
Allow a trailing comma in assert_eq/ne macro
Browse files Browse the repository at this point in the history
  • Loading branch information
KamilaBorowska committed Nov 9, 2017
1 parent fd9ecfd commit 6a92c0f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
6 changes: 6 additions & 0 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down
8 changes: 0 additions & 8 deletions src/test/ui/macros/assert_eq_trailing_comma.stderr

This file was deleted.

8 changes: 0 additions & 8 deletions src/test/ui/macros/assert_ne_trailing_comma.stderr

This file was deleted.

0 comments on commit 6a92c0f

Please sign in to comment.