]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/parse/token.rs
std: Rename Show/String to Debug/Display
[rust.git] / src / libsyntax / parse / token.rs
index 437867389103661e2af8bbc67b6cb9a3b3630265..6112ee851ac8dbb11abb6db2bc29014abebd5e47 100644 (file)
@@ -183,14 +183,14 @@ pub fn can_begin_expr(&self) -> bool {
             Underscore                  => true,
             Tilde                       => true,
             Literal(_, _)               => true,
-            Pound                       => true,
-            At                          => true,
             Not                         => true,
             BinOp(Minus)                => true,
             BinOp(Star)                 => true,
             BinOp(And)                  => true,
             BinOp(Or)                   => true, // in lambda syntax
             OrOr                        => true, // in lambda syntax
+            AndAnd                      => true, // double borrow
+            DotDot                      => true, // range notation
             ModSep                      => true,
             Interpolated(NtExpr(..))    => true,
             Interpolated(NtIdent(..))   => true,
@@ -375,7 +375,7 @@ pub enum Nonterminal {
     NtTT(P<ast::TokenTree>), // needs P'ed to break a circularity
 }
 
-impl fmt::Show for Nonterminal {
+impl fmt::Debug for Nonterminal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             NtItem(..) => f.pad("NtItem(..)"),
@@ -480,7 +480,7 @@ fn mk_fresh_ident_interner() -> IdentInterner {
         $(init_vec.push($si_str);)*
         $(init_vec.push($sk_str);)*
         $(init_vec.push($rk_str);)*
-        interner::StrInterner::prefill(init_vec.index(&FullRange))
+        interner::StrInterner::prefill(&init_vec[])
     }
 }}
 
@@ -629,7 +629,7 @@ fn new_from_rc_str(string: RcStr) -> InternedString {
 
     #[inline]
     pub fn get<'a>(&'a self) -> &'a str {
-        self.string.index(&FullRange)
+        &self.string[]
     }
 }
 
@@ -651,49 +651,49 @@ fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
     }
 }
 
-impl fmt::Show for InternedString {
+impl fmt::Debug for InternedString {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::String::fmt(self, f)
+        fmt::Debug::fmt(&self.string[], f)
     }
 }
 
-impl fmt::String for InternedString {
+impl fmt::Display for InternedString {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "{}", self.string.index(&FullRange))
+        fmt::Display::fmt(&self.string[], f)
     }
 }
 
 impl<'a> PartialEq<&'a str> for InternedString {
     #[inline(always)]
     fn eq(&self, other: & &'a str) -> bool {
-        PartialEq::eq(self.string.index(&FullRange), *other)
+        PartialEq::eq(&self.string[], *other)
     }
     #[inline(always)]
     fn ne(&self, other: & &'a str) -> bool {
-        PartialEq::ne(self.string.index(&FullRange), *other)
+        PartialEq::ne(&self.string[], *other)
     }
 }
 
 impl<'a> PartialEq<InternedString > for &'a str {
     #[inline(always)]
     fn eq(&self, other: &InternedString) -> bool {
-        PartialEq::eq(*self, other.string.index(&FullRange))
+        PartialEq::eq(*self, &other.string[])
     }
     #[inline(always)]
     fn ne(&self, other: &InternedString) -> bool {
-        PartialEq::ne(*self, other.string.index(&FullRange))
+        PartialEq::ne(*self, &other.string[])
     }
 }
 
 impl Decodable for InternedString {
     fn decode<D: Decoder>(d: &mut D) -> Result<InternedString, D::Error> {
-        Ok(get_name(get_ident_interner().intern(try!(d.read_str()).index(&FullRange))))
+        Ok(get_name(get_ident_interner().intern(&try!(d.read_str())[])))
     }
 }
 
 impl Encodable for InternedString {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
-        s.emit_str(self.string.index(&FullRange))
+        s.emit_str(&self.string[])
     }
 }