From d5c3becf00452fd1d35e695494d7ae41dedb11d8 Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Fri, 13 Jan 2017 01:57:48 +0100 Subject: 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`. --- src/libstd/collections/hash/map.rs | 4 ++-- src/libstd/io/error.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstd') 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 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(); /// } /// } /// -- cgit 1.4.1-3-g733a5