diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index b354116993c..21c6c846576 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -134,12 +134,23 @@ impl FromStr for bool { /// Parse a `bool` from a string. /// - /// Yields an `Option`, because `s` may or may not actually be - /// parseable. + /// Yields a `Result`, because `s` may or may not + /// actually be parseable. /// /// # Examples /// /// ```rust + /// use std::str::FromStr; + /// + /// assert_eq!(FromStr::from_str("true"), Ok(true)); + /// assert_eq!(FromStr::from_str("false"), Ok(false)); + /// assert!(::from_str("not even a boolean").is_err()); + /// ``` + /// + /// Note, in many cases, the StrExt::parse() which is based on + /// this FromStr::from_str() is more proper. + /// + /// ```rust /// assert_eq!("true".parse(), Ok(true)); /// assert_eq!("false".parse(), Ok(false)); /// assert!("not even a boolean".parse::().is_err());