Skip to content

Commit

Permalink
Rollup merge of rust-lang#65962 - kevincox:patch-1, r=sfackler
Browse files Browse the repository at this point in the history
Fix logic in example.

The example claims SuperiorThanZero and presumably Zero is not Superior than itself so it should not be allowed.
  • Loading branch information
pietroalbini authored Nov 5, 2019
2 parents 0a28415 + e7fd580 commit 370d01a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,16 @@ pub trait TryInto<T>: Sized {
/// ```
/// use std::convert::TryFrom;
///
/// struct SuperiorThanZero(i32);
/// struct GreaterThanZero(i32);
///
/// impl TryFrom<i32> for SuperiorThanZero {
/// impl TryFrom<i32> for GreaterThanZero {
/// type Error = &'static str;
///
/// fn try_from(value: i32) -> Result<Self, Self::Error> {
/// if value < 0 {
/// Err("SuperiorThanZero only accepts value superior than zero!")
/// if value <= 0 {
/// Err("GreaterThanZero only accepts value superior than zero!")
/// } else {
/// Ok(SuperiorThanZero(value))
/// Ok(GreaterThanZero(value))
/// }
/// }
/// }
Expand Down

0 comments on commit 370d01a

Please sign in to comment.