about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-11 21:37:43 -0700
committerbors <bors@rust-lang.org>2013-06-11 21:37:43 -0700
commitcc80652e4a627378a36b50fab9e72349129cb56a (patch)
treeada1e23e714b7dc587d86aeddb54a954dded8f3a /src/libsyntax/parse
parent7033dfcf917ccef44fbc3e33d31814455c13b4c6 (diff)
parent9f0c85acc967110c85f9a8bdcb32df4606a6dff5 (diff)
downloadrust-cc80652e4a627378a36b50fab9e72349129cb56a.tar.gz
rust-cc80652e4a627378a36b50fab9e72349129cb56a.zip
auto merge of #7060 : huonw/rust/more-str, r=thestinger
There are now only half-a-dozen or so functions left `std::str` that should be methods.

Highlights:
- `.substr` was removed, since most of the uses of it in the code base were actually incorrect (it had a weird mixing of a byte index and a unicode character count), adding `.slice_chars` if one wants to handle characters, and the normal `.slice` method to handle bytes.
- Code duplication between the two impls for `connect` and `concat` was removed via a new `Str` trait, that is purely designed to allow an explicit -> `&str` conversion (`.as_slice()`)
- Deconfuse the 5 different functions for converting to `[u8]` (3 of which had actually incorrect documentation: implying that they didn't have the null terminator), into 3: `as_bytes` (all strings), `as_bytes_with_null` (`&'static str`, `@str` and `~str`) and `as_bytes_with_null_consume` (`~str`). None of these allocate, unlike the old versions.

(cc @thestinger)
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/token.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 7359448a8f2..91605db77b5 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -193,7 +193,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
         }
         body
       }
-      LIT_STR(ref s) => { ~"\"" + str::escape_default(*ident_to_str(s)) + "\"" }
+      LIT_STR(ref s) => { ~"\"" + ident_to_str(s).escape_default() + "\"" }
 
       /* Name components */
       IDENT(s, _) => copy *in.get(s.name),