mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
style: Update doctests for TryFrom<integer> for bool
These doctests are attached to the `TryFrom` trait. Therefore, it is easier to understand to use the `try_from` method instead of the `try_into` method.
This commit is contained in:
@@ -343,11 +343,11 @@ impl const TryFrom<$int> for bool {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
#[doc = concat!("assert_eq!(0_", stringify!($int), ".try_into(), Ok(false));")]
|
||||
#[doc = concat!("assert_eq!(bool::try_from(0_", stringify!($int), "), Ok(false));")]
|
||||
///
|
||||
#[doc = concat!("assert_eq!(1_", stringify!($int), ".try_into(), Ok(true));")]
|
||||
#[doc = concat!("assert_eq!(bool::try_from(1_", stringify!($int), "), Ok(true));")]
|
||||
///
|
||||
#[doc = concat!("assert!(<", stringify!($int), " as TryInto<bool>>::try_into(2).is_err());")]
|
||||
#[doc = concat!("assert!(bool::try_from(2_", stringify!($int), ").is_err());")]
|
||||
/// ```
|
||||
#[inline]
|
||||
fn try_from(i: $int) -> Result<Self, Self::Error> {
|
||||
|
||||
Reference in New Issue
Block a user