From e76a1846153209b15dfbf697a33c25214bb753b3 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Wed, 23 Oct 2019 15:42:52 +0200 Subject: [PATCH] Document guard expressions in `matches!` --- src/libcore/macros.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 6e19878ef17d..35558e3abcdd 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -238,7 +238,10 @@ macro_rules! debug_assert_ne { ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); }) } -/// Returns whether the given expression matches (any of) the given pattern(s). +/// Returns whether the given expression matches any of the given patterns. +/// +/// Like in a `match` expression, the pattern can be optionally followed by `if` +/// and a guard expression that has access to names bound by the pattern. /// /// # Examples ///