From 3d03c8cd74353defdee8deb67cfa36a1b9c9cc14 Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Sat, 28 Feb 2026 04:17:41 +0900 Subject: [PATCH] style: Update doctests for `TryFrom 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. --- library/core/src/convert/num.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/convert/num.rs b/library/core/src/convert/num.rs index 03650615e25a..9759afa3a211 100644 --- a/library/core/src/convert/num.rs +++ b/library/core/src/convert/num.rs @@ -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>::try_into(2).is_err());")] + #[doc = concat!("assert!(bool::try_from(2_", stringify!($int), ").is_err());")] /// ``` #[inline] fn try_from(i: $int) -> Result {