Add trailing comma support to matches macro

This commit is contained in:
Christian Duerr 2020-07-28 18:42:13 +02:00
parent 2c28244cf0
commit f3d7645fb7
No known key found for this signature in database
GPG Key ID: 85CDAE3C164BA7B4
1 changed files with 1 additions and 1 deletions

View File

@ -255,7 +255,7 @@ macro_rules! debug_assert_ne {
#[macro_export]
#[stable(feature = "matches_macro", since = "1.42.0")]
macro_rules! matches {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )?) => {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
match $expression {
$( $pattern )|+ $( if $guard )? => true,
_ => false