Fix assert_matches doc examples.
This commit is contained in:
parent
0a8e401188
commit
5bd1204fc2
1 changed files with 6 additions and 2 deletions
|
@ -124,13 +124,15 @@ macro_rules! assert_ne {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(assert_matches)]
|
||||||
|
///
|
||||||
/// let a = 1u32.checked_add(2);
|
/// let a = 1u32.checked_add(2);
|
||||||
/// let b = 1u32.checked_sub(2);
|
/// let b = 1u32.checked_sub(2);
|
||||||
/// assert_matches!(a, Some(_));
|
/// assert_matches!(a, Some(_));
|
||||||
/// assert_matches!(b, None);
|
/// assert_matches!(b, None);
|
||||||
///
|
///
|
||||||
/// let c = Ok("abc".to_string());
|
/// 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]
|
#[macro_export]
|
||||||
#[unstable(feature = "assert_matches", issue = "none")]
|
#[unstable(feature = "assert_matches", issue = "none")]
|
||||||
|
@ -279,13 +281,15 @@ macro_rules! debug_assert_ne {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(assert_matches)]
|
||||||
|
///
|
||||||
/// let a = 1u32.checked_add(2);
|
/// let a = 1u32.checked_add(2);
|
||||||
/// let b = 1u32.checked_sub(2);
|
/// let b = 1u32.checked_sub(2);
|
||||||
/// debug_assert_matches!(a, Some(_));
|
/// debug_assert_matches!(a, Some(_));
|
||||||
/// debug_assert_matches!(b, None);
|
/// debug_assert_matches!(b, None);
|
||||||
///
|
///
|
||||||
/// let c = Ok("abc".to_string());
|
/// 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]
|
#[macro_export]
|
||||||
#[unstable(feature = "assert_matches", issue = "none")]
|
#[unstable(feature = "assert_matches", issue = "none")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue