From e1974a4f1f05fc5c1c10d87cb20937ef87a68d9d Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Wed, 30 Oct 2019 12:56:54 +0000 Subject: [PATCH 1/2] Fix logic in example. The example claims SuperiorThanZero and presumably Zero is not Superior than itself so it should not be allowed. --- src/libcore/convert.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 3cd2337ee59a5..0cef6707e47e6 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -444,7 +444,7 @@ pub trait TryInto: Sized { /// type Error = &'static str; /// /// fn try_from(value: i32) -> Result { -/// if value < 0 { +/// if value <= 0 { /// Err("SuperiorThanZero only accepts value superior than zero!") /// } else { /// Ok(SuperiorThanZero(value)) From e7fd580e7cd68f68cdc585a2f785d49c8fe7fefa Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Sat, 2 Nov 2019 13:12:07 +0000 Subject: [PATCH 2/2] Rename SuperiorThanZero -> GreaterThanZero --- src/libcore/convert.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 0cef6707e47e6..16045f64d461e 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -438,16 +438,16 @@ pub trait TryInto: Sized { /// ``` /// use std::convert::TryFrom; /// -/// struct SuperiorThanZero(i32); +/// struct GreaterThanZero(i32); /// -/// impl TryFrom for SuperiorThanZero { +/// impl TryFrom for GreaterThanZero { /// type Error = &'static str; /// /// fn try_from(value: i32) -> Result { /// if value <= 0 { -/// Err("SuperiorThanZero only accepts value superior than zero!") +/// Err("GreaterThanZero only accepts value superior than zero!") /// } else { -/// Ok(SuperiorThanZero(value)) +/// Ok(GreaterThanZero(value)) /// } /// } /// }