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:
Shun Sakai
2026-02-28 04:17:41 +09:00
parent 3a70d0349f
commit 3d03c8cd74
+3 -3
View File
@@ -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> {