Skip to content

Commit 4ddde14

Browse files
committed
syntax: Replace String::from_str with the stable String::from
1 parent 76f2f1c commit 4ddde14

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub fn name_to_dummy_lifetime(name: Name) -> Lifetime {
238238
pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: Option<&Ty>) -> Ident {
239239
let mut pretty = match ty {
240240
Some(t) => pprust::ty_to_string(t),
241-
None => String::from_str("..")
241+
None => String::from("..")
242242
};
243243

244244
match *trait_ref {

src/libsyntax/codemap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ impl CodeMap {
559559
// FIXME #12884: no efficient/safe way to remove from the start of a string
560560
// and reuse the allocation.
561561
let mut src = if src.starts_with("\u{feff}") {
562-
String::from_str(&src[3..])
562+
String::from(&src[3..])
563563
} else {
564-
String::from_str(&src[..])
564+
String::from(&src[..])
565565
};
566566

567567
// Append '\n' in case it's not already there.

src/libsyntax/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ fn highlight_lines(err: &mut EmitterWriter,
623623
}
624624

625625
try!(write!(&mut err.dst, "{}", s));
626-
let mut s = String::from_str("^");
626+
let mut s = String::from("^");
627627
let count = match lastc {
628628
// Most terminals have a tab stop every eight columns by default
629629
'\t' => 8 - col%8,

src/libsyntax/parse/lexer/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn read_block_comment(rdr: &mut StringReader,
246246
rdr.bump();
247247
rdr.bump();
248248

249-
let mut curr_line = String::from_str("/*");
249+
let mut curr_line = String::from("/*");
250250

251251
// doc-comments are not really comments, they are attributes
252252
if (rdr.curr_is('*') && !rdr.nextch_is('*')) || rdr.curr_is('!') {

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4834,7 +4834,7 @@ impl<'a> Parser<'a> {
48344834
let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
48354835
match included_mod_stack.iter().position(|p| *p == path) {
48364836
Some(i) => {
4837-
let mut err = String::from_str("circular modules: ");
4837+
let mut err = String::from("circular modules: ");
48384838
let len = included_mod_stack.len();
48394839
for p in &included_mod_stack[i.. len] {
48404840
err.push_str(&p.to_string_lossy());

src/libsyntax/print/pp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn buf_str(toks: &[Token],
131131
assert_eq!(n, szs.len());
132132
let mut i = left;
133133
let mut l = lim;
134-
let mut s = string::String::from_str("[");
134+
let mut s = string::String::from("[");
135135
while i != right && l != 0 {
136136
l -= 1;
137137
if i != left {

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,13 +2794,13 @@ impl<'a> State<'a> {
27942794
match lit.node {
27952795
ast::LitStr(ref st, style) => self.print_string(&st, style),
27962796
ast::LitByte(byte) => {
2797-
let mut res = String::from_str("b'");
2797+
let mut res = String::from("b'");
27982798
res.extend(ascii::escape_default(byte).map(|c| c as char));
27992799
res.push('\'');
28002800
word(&mut self.s, &res[..])
28012801
}
28022802
ast::LitChar(ch) => {
2803-
let mut res = String::from_str("'");
2803+
let mut res = String::from("'");
28042804
res.extend(ch.escape_default());
28052805
res.push('\'');
28062806
word(&mut self.s, &res[..])

0 commit comments

Comments
 (0)