]> git.lizzy.rs Git - rust.git/commitdiff
Make From::from example more idiomatic / simpler
authorCorey Farwell <coreyf@rwell.org>
Mon, 27 Apr 2015 03:18:19 +0000 (23:18 -0400)
committerCorey Farwell <coreyf@rwell.org>
Mon, 27 Apr 2015 03:18:19 +0000 (23:18 -0400)
src/libcore/convert.rs

index d9cda58d9ebedd6e364bffe388e4c5979b43c8d6..d3de77a9241e3f7dbab05cbe77f2b89ccba5c647 100644 (file)
@@ -83,10 +83,8 @@ pub trait Into<T>: Sized {
 /// `String` implements `From<&str>`:
 ///
 /// ```
-/// let s = "hello";
 /// let string = "hello".to_string();
-///
-/// let other_string: String = From::from(s);
+/// let other_string = String::from("hello");
 ///
 /// assert_eq!(string, other_string);
 /// ```