From 5633d4641f7d63805e3c12c899f8401410bd825f Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 19 May 2014 17:23:26 -0700 Subject: libstd: Remove all uses of `~str` from `libstd` --- src/libsyntax/parse/lexer.rs | 7 +++---- src/libsyntax/parse/parser.rs | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c78d2aaf3a7..5a7a816dbb3 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -589,13 +589,13 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token { bump(rdr); bump(rdr); check_float_base(rdr, start_bpos, rdr.last_pos, base); - return token::LIT_FLOAT(str_to_ident(num_str.into_owned()), + return token::LIT_FLOAT(str_to_ident(num_str.as_slice()), ast::TyF32); } else if c == '6' && n == '4' { bump(rdr); bump(rdr); check_float_base(rdr, start_bpos, rdr.last_pos, base); - return token::LIT_FLOAT(str_to_ident(num_str.into_owned()), + return token::LIT_FLOAT(str_to_ident(num_str.as_slice()), ast::TyF64); /* FIXME (#2252): if this is out of range for either a 32-bit or 64-bit float, it won't be noticed till the @@ -612,8 +612,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token { } if is_float { check_float_base(rdr, start_bpos, rdr.last_pos, base); - return token::LIT_FLOAT_UNSUFFIXED(str_to_ident( - num_str.into_owned())); + return token::LIT_FLOAT_UNSUFFIXED(str_to_ident(num_str.as_slice())); } else { if num_str.len() == 0u { fatal_span(rdr, start_bpos, rdr.last_pos, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6bddb45201c..7d0276ae16f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4242,8 +4242,8 @@ impl<'a> Parser<'a> { Some(d) => (dir_path.join(d), true), None => { let mod_name = mod_string.get().to_owned(); - let default_path_str = mod_name + ".rs"; - let secondary_path_str = mod_name + "/mod.rs"; + let default_path_str = format!("{}.rs", mod_name); + let secondary_path_str = format!("{}/mod.rs", mod_name); let default_path = dir_path.join(default_path_str.as_slice()); let secondary_path = dir_path.join(secondary_path_str.as_slice()); let default_exists = default_path.exists(); @@ -4310,7 +4310,7 @@ impl<'a> Parser<'a> { err.push_str(" -> "); } err.push_str(path.display().as_maybe_owned().as_slice()); - self.span_fatal(id_sp, err.into_owned()); + self.span_fatal(id_sp, err.as_slice()); } None => () } -- cgit 1.4.1-3-g733a5