syntax: Replace String::from_str with the stable String::from
This commit is contained in:
parent
8553658952
commit
2937cce70c
|
@ -238,7 +238,7 @@ pub fn name_to_dummy_lifetime(name: Name) -> Lifetime {
|
|||
pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: Option<&Ty>) -> Ident {
|
||||
let mut pretty = match ty {
|
||||
Some(t) => pprust::ty_to_string(t),
|
||||
None => String::from_str("..")
|
||||
None => String::from("..")
|
||||
};
|
||||
|
||||
match *trait_ref {
|
||||
|
|
|
@ -557,9 +557,9 @@ impl CodeMap {
|
|||
// FIXME #12884: no efficient/safe way to remove from the start of a string
|
||||
// and reuse the allocation.
|
||||
let mut src = if src.starts_with("\u{feff}") {
|
||||
String::from_str(&src[3..])
|
||||
String::from(&src[3..])
|
||||
} else {
|
||||
String::from_str(&src[..])
|
||||
String::from(&src[..])
|
||||
};
|
||||
|
||||
// Append '\n' in case it's not already there.
|
||||
|
|
|
@ -644,7 +644,7 @@ fn highlight_lines(err: &mut EmitterWriter,
|
|||
}
|
||||
|
||||
try!(write!(&mut err.dst, "{}", s));
|
||||
let mut s = String::from_str("^");
|
||||
let mut s = String::from("^");
|
||||
let count = match lastc {
|
||||
// Most terminals have a tab stop every eight columns by default
|
||||
'\t' => 8 - col%8,
|
||||
|
|
|
@ -246,7 +246,7 @@ fn read_block_comment(rdr: &mut StringReader,
|
|||
rdr.bump();
|
||||
rdr.bump();
|
||||
|
||||
let mut curr_line = String::from_str("/*");
|
||||
let mut curr_line = String::from("/*");
|
||||
|
||||
// doc-comments are not really comments, they are attributes
|
||||
if (rdr.curr_is('*') && !rdr.nextch_is('*')) || rdr.curr_is('!') {
|
||||
|
|
|
@ -4834,7 +4834,7 @@ impl<'a> Parser<'a> {
|
|||
let mut included_mod_stack = self.sess.included_mod_stack.borrow_mut();
|
||||
match included_mod_stack.iter().position(|p| *p == path) {
|
||||
Some(i) => {
|
||||
let mut err = String::from_str("circular modules: ");
|
||||
let mut err = String::from("circular modules: ");
|
||||
let len = included_mod_stack.len();
|
||||
for p in &included_mod_stack[i.. len] {
|
||||
err.push_str(&p.to_string_lossy());
|
||||
|
|
|
@ -131,7 +131,7 @@ pub fn buf_str(toks: &[Token],
|
|||
assert_eq!(n, szs.len());
|
||||
let mut i = left;
|
||||
let mut l = lim;
|
||||
let mut s = string::String::from_str("[");
|
||||
let mut s = string::String::from("[");
|
||||
while i != right && l != 0 {
|
||||
l -= 1;
|
||||
if i != left {
|
||||
|
|
|
@ -2794,13 +2794,13 @@ impl<'a> State<'a> {
|
|||
match lit.node {
|
||||
ast::LitStr(ref st, style) => self.print_string(&st, style),
|
||||
ast::LitByte(byte) => {
|
||||
let mut res = String::from_str("b'");
|
||||
let mut res = String::from("b'");
|
||||
res.extend(ascii::escape_default(byte).map(|c| c as char));
|
||||
res.push('\'');
|
||||
word(&mut self.s, &res[..])
|
||||
}
|
||||
ast::LitChar(ch) => {
|
||||
let mut res = String::from_str("'");
|
||||
let mut res = String::from("'");
|
||||
res.extend(ch.escape_default());
|
||||
res.push('\'');
|
||||
word(&mut self.s, &res[..])
|
||||
|
|
Loading…
Reference in New Issue