Skip to content

Commit

Permalink
Fix assert_matches doc examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Mar 4, 2021
1 parent 0a8e401 commit 5bd1204
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ macro_rules! assert_ne {
/// # Examples
///
/// ```
/// #![feature(assert_matches)]
///
/// let a = 1u32.checked_add(2);
/// let b = 1u32.checked_sub(2);
/// assert_matches!(a, Some(_));
/// assert_matches!(b, None);
///
/// let c = Ok("abc".to_string());
/// assert_matches!(a, Ok(x) | Err(x) if x.len() < 100);
/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
/// ```
#[macro_export]
#[unstable(feature = "assert_matches", issue = "none")]
Expand Down Expand Up @@ -279,13 +281,15 @@ macro_rules! debug_assert_ne {
/// # Examples
///
/// ```
/// #![feature(assert_matches)]
///
/// let a = 1u32.checked_add(2);
/// let b = 1u32.checked_sub(2);
/// debug_assert_matches!(a, Some(_));
/// debug_assert_matches!(b, None);
///
/// let c = Ok("abc".to_string());
/// debug_assert_matches!(a, Ok(x) | Err(x) if x.len() < 100);
/// debug_assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
/// ```
#[macro_export]
#[unstable(feature = "assert_matches", issue = "none")]
Expand Down

0 comments on commit 5bd1204

Please sign in to comment.