about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2017-01-13 01:57:48 +0100
committerStjepan Glavina <stjepang@gmail.com>2017-01-13 01:57:48 +0100
commitd5c3becf00452fd1d35e695494d7ae41dedb11d8 (patch)
tree3bcc12a08e1317e692612e2478ba7811b08eb281
parente35717814686ea3e3d44a8f5c1c20d1cd50be82a (diff)
downloadrust-d5c3becf00452fd1d35e695494d7ae41dedb11d8.tar.gz
rust-d5c3becf00452fd1d35e695494d7ae41dedb11d8.zip
Change `to_owned` to `to_string` in docs
We should teach conversion from `str` to `String` using `to_string`
rather than the legacy `to_owned`.
-rw-r--r--src/libcollections/btree/map.rs4
-rw-r--r--src/libcore/any.rs16
-rw-r--r--src/libstd/collections/hash/map.rs4
-rw-r--r--src/libstd/io/error.rs4
4 files changed, 14 insertions, 14 deletions
diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs
index 98c71967f3c..85e1e133b7d 100644
--- a/src/libcollections/btree/map.rs
+++ b/src/libcollections/btree/map.rs
@@ -1990,11 +1990,11 @@ impl<'a, K: Ord, V> Entry<'a, K, V> {
     /// use std::collections::BTreeMap;
     ///
     /// let mut map: BTreeMap<&str, String> = BTreeMap::new();
-    /// let s = "hoho".to_owned();
+    /// let s = "hoho".to_string();
     ///
     /// map.entry("poneyland").or_insert_with(|| s);
     ///
-    /// assert_eq!(map["poneyland"], "hoho".to_owned());
+    /// assert_eq!(map["poneyland"], "hoho".to_string());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
diff --git a/src/libcore/any.rs b/src/libcore/any.rs
index eb0636e8576..78f3cd5576e 100644
--- a/src/libcore/any.rs
+++ b/src/libcore/any.rs
@@ -101,7 +101,7 @@ pub trait Any: 'static {
     ///
     /// fn main() {
     ///     assert_eq!(is_string(&0), false);
-    ///     assert_eq!(is_string(&"cookie monster".to_owned()), true);
+    ///     assert_eq!(is_string(&"cookie monster".to_string()), true);
     /// }
     /// ```
     #[unstable(feature = "get_type_id",
@@ -154,7 +154,7 @@ impl Any {
     ///
     /// fn main() {
     ///     is_string(&0);
-    ///     is_string(&"cookie monster".to_owned());
+    ///     is_string(&"cookie monster".to_string());
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -188,7 +188,7 @@ impl Any {
     ///
     /// fn main() {
     ///     print_if_string(&0);
-    ///     print_if_string(&"cookie monster".to_owned());
+    ///     print_if_string(&"cookie monster".to_string());
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -219,7 +219,7 @@ impl Any {
     ///
     /// fn main() {
     ///     let mut x = 10u32;
-    ///     let mut s = "starlord".to_owned();
+    ///     let mut s = "starlord".to_string();
     ///
     ///     modify_if_u32(&mut x);
     ///     modify_if_u32(&mut s);
@@ -259,7 +259,7 @@ impl Any+Send {
     ///
     /// fn main() {
     ///     is_string(&0);
-    ///     is_string(&"cookie monster".to_owned());
+    ///     is_string(&"cookie monster".to_string());
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -285,7 +285,7 @@ impl Any+Send {
     ///
     /// fn main() {
     ///     print_if_string(&0);
-    ///     print_if_string(&"cookie monster".to_owned());
+    ///     print_if_string(&"cookie monster".to_string());
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -309,7 +309,7 @@ impl Any+Send {
     ///
     /// fn main() {
     ///     let mut x = 10u32;
-    ///     let mut s = "starlord".to_owned();
+    ///     let mut s = "starlord".to_string();
     ///
     ///     modify_if_u32(&mut x);
     ///     modify_if_u32(&mut s);
@@ -359,7 +359,7 @@ impl TypeId {
     ///
     /// fn main() {
     ///     assert_eq!(is_string(&0), false);
-    ///     assert_eq!(is_string(&"cookie monster".to_owned()), true);
+    ///     assert_eq!(is_string(&"cookie monster".to_string()), true);
     /// }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 2fa3a9c4844..a314717a877 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -1779,11 +1779,11 @@ impl<'a, K, V> Entry<'a, K, V> {
     /// use std::collections::HashMap;
     ///
     /// let mut map: HashMap<&str, String> = HashMap::new();
-    /// let s = "hoho".to_owned();
+    /// let s = "hoho".to_string();
     ///
     /// map.entry("poneyland").or_insert_with(|| s);
     ///
-    /// assert_eq!(map["poneyland"], "hoho".to_owned());
+    /// assert_eq!(map["poneyland"], "hoho".to_string());
     /// ```
     pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
         match self {
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs
index 795c89c0007..434f522cc1e 100644
--- a/src/libstd/io/error.rs
+++ b/src/libstd/io/error.rs
@@ -388,12 +388,12 @@ impl Error {
     /// impl MyError {
     ///     fn new() -> MyError {
     ///         MyError {
-    ///             v: "oh no!".to_owned()
+    ///             v: "oh no!".to_string()
     ///         }
     ///     }
     ///
     ///     fn change_message(&mut self, new_message: &str) {
-    ///         self.v = new_message.to_owned();
+    ///         self.v = new_message.to_string();
     ///     }
     /// }
     ///