Skip to content

Commit d2495fa

Browse files
committed
Drop link to matches macro and link matches macro to assert_matches.
1 parent e478111 commit d2495fa

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

library/core/src/macros/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ macro_rules! assert_ne {
118118
/// the debug representation, of the actual value shape that did not meet expectation. In contrast
119119
/// using [`assert!`] will only print that the expectation was not met, but not why.
120120
///
121-
/// The pattern syntax is exactly the same as found in a match arm and the [`matches!`] macro. The
121+
/// The pattern syntax is exactly the same as found in a match arm and the `matches!` macro. The
122122
/// optional if guard can be used to add additional checks that must be true for the matched value,
123123
/// otherwise this macro will panic.
124124
///
@@ -385,7 +385,7 @@ macro_rules! debug_assert_ne {
385385
/// print the debug representation, of the actual value shape that did not meet expectation. In
386386
/// contrast using [`debug_assert!`] will only print that the expectation was not met, but not why.
387387
///
388-
/// The pattern syntax is exactly the same as found in a match arm and the [`matches!`] macro. The
388+
/// The pattern syntax is exactly the same as found in a match arm and the `matches!` macro. The
389389
/// optional if guard can be used to add additional checks that must be true for the matched value,
390390
/// otherwise this macro will panic.
391391
///
@@ -430,10 +430,15 @@ pub macro debug_assert_matches($($arg:tt)*) {
430430
}
431431
}
432432

433-
/// Returns whether the given expression matches any of the given patterns.
433+
/// Returns whether the given expression matches the provided pattern.
434434
///
435-
/// Like in a `match` expression, the pattern can be optionally followed by `if`
436-
/// and a guard expression that has access to names bound by the pattern.
435+
/// The pattern syntax is exactly the same as found in a match arm. The optional if guard can be
436+
/// used to add additional checks that must be true for the matched value, otherwise this macro will
437+
/// return `false`.
438+
///
439+
/// When testing that a value matches a pattern, it's generally preferable to use
440+
/// [`assert_matches!`] as it will print the debug representation of the value if the assertion
441+
/// fails.
437442
///
438443
/// # Examples
439444
///

0 commit comments

Comments
 (0)