Skip to content

Commit 6a92c0f

Browse files
Allow a trailing comma in assert_eq/ne macro
1 parent fd9ecfd commit 6a92c0f

5 files changed

+6
-16
lines changed

src/libcore/macros.rs

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ macro_rules! assert_eq {
120120
}
121121
}
122122
});
123+
($left:expr, $right:expr,) => ({
124+
assert_eq!($left, $right)
125+
});
123126
($left:expr, $right:expr, $($arg:tt)+) => ({
124127
match (&($left), &($right)) {
125128
(left_val, right_val) => {
@@ -168,6 +171,9 @@ macro_rules! assert_ne {
168171
}
169172
}
170173
});
174+
($left:expr, $right:expr,) => {
175+
assert_ne!($left, $right)
176+
};
171177
($left:expr, $right:expr, $($arg:tt)+) => ({
172178
match (&($left), &($right)) {
173179
(left_val, right_val) => {

src/test/ui/macros/assert_eq_trailing_comma.stderr

-8
This file was deleted.

src/test/ui/macros/assert_ne_trailing_comma.stderr

-8
This file was deleted.

0 commit comments

Comments
 (0)