Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to_owned to to_string in docs #39024

Merged
merged 1 commit into from Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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")]
Expand All @@ -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")]
Expand All @@ -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);
Expand Down Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
/// }
/// }
///
Expand Down