about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonrad Borowski <konrad@borowski.pw>2023-03-06 21:11:01 +0100
committerKonrad Borowski <konrad@borowski.pw>2023-03-06 21:21:06 +0100
commitdfe4c49e9b8f724d43328eee46b733f65d3d5b25 (patch)
tree8543aae6bc3a148bb28a00ef52f286df1de22072
parentf63ccaf25f74151a5d8ce057904cd944074b01d2 (diff)
downloadrust-dfe4c49e9b8f724d43328eee46b733f65d3d5b25.tar.gz
rust-dfe4c49e9b8f724d43328eee46b733f65d3d5b25.zip
Use Edition 2021 :pat in matches macro
This makes the macro syntax used in documentation more readable.
-rw-r--r--library/core/src/macros/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 3b026bc0e0f..529f62f4d6c 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -340,9 +340,9 @@ pub macro debug_assert_matches($($arg:tt)*) {
 #[stable(feature = "matches_macro", since = "1.42.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")]
 macro_rules! matches {
-    ($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
+    ($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
         match $expression {
-            $( $pattern )|+ $( if $guard )? => true,
+            $pattern $(if $guard)? => true,
             _ => false
         }
     };