Skip to content

Commit c7fe4ff

Browse files
committed
std: Remove String::from_owned_str as it's redundant
[breaking-change]
1 parent 746d086 commit c7fe4ff

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/libgetopts/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
671671
hasarg: hasarg,
672672
..} = (*optref).clone();
673673

674-
let mut row = String::from_owned_str(" ".repeat(4));
674+
let mut row = " ".repeat(4);
675675

676676
// short option
677677
match short_name.len() {

src/libstd/str.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,10 +910,9 @@ impl OwnedStr for String {
910910
}
911911

912912
#[inline]
913-
fn append(self, rhs: &str) -> String {
914-
let mut new_str = String::from_owned_str(self);
915-
new_str.push_str(rhs);
916-
new_str
913+
fn append(mut self, rhs: &str) -> String {
914+
self.push_str(rhs);
915+
self
917916
}
918917
}
919918

src/libstd/string.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ impl String {
6868
}
6969
}
7070

71-
/// Creates a new string buffer from the given owned string, taking care not to copy it.
71+
#[allow(missing_doc)]
72+
#[deprecated = "obsoleted by the removal of ~str"]
7273
#[inline]
7374
pub fn from_owned_str(string: String) -> String {
7475
string

src/libtest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl TestDesc {
110110
use std::num::Saturating;
111111
let mut name = String::from_str(self.name.as_slice());
112112
let fill = column_count.saturating_sub(name.len());
113-
let mut pad = String::from_owned_str(" ".repeat(fill));
113+
let mut pad = " ".repeat(fill);
114114
match align {
115115
PadNone => name,
116116
PadOnLeft => {

0 commit comments

Comments
 (0)