about summary refs log tree commit diff
path: root/src/libsyntax/ast_map
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2015-01-07 11:58:31 -0500
committerJorge Aparicio <japaricious@gmail.com>2015-01-07 17:35:56 -0500
commit517f1cc63c1a5df148fdeef56791f66771d3d8e8 (patch)
tree0d321b5be3d9610f460561e8dc446a2132bb5422 /src/libsyntax/ast_map
parent6e2bfe4ae8277f0cfe76831b446d50820b4527f5 (diff)
downloadrust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.tar.gz
rust-517f1cc63c1a5df148fdeef56791f66771d3d8e8.zip
use slicing sugar
Diffstat (limited to 'src/libsyntax/ast_map')
-rw-r--r--src/libsyntax/ast_map/mod.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 7496a0f9f26..adcb9ff9cc2 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -106,7 +106,7 @@ pub fn path_to_string<PI: Iterator<Item=PathElem>>(path: PI) -> String {
         if !s.is_empty() {
             s.push_str("::");
         }
-        s.push_str(e.index(&FullRange));
+        s.push_str(&e[]);
         s
     }).to_string()
 }
@@ -483,20 +483,20 @@ impl<'ast> Map<'ast> {
         F: FnOnce(Option<&[Attribute]>) -> T,
     {
         let attrs = match self.get(id) {
-            NodeItem(i) => Some(i.attrs.index(&FullRange)),
-            NodeForeignItem(fi) => Some(fi.attrs.index(&FullRange)),
+            NodeItem(i) => Some(&i.attrs[]),
+            NodeForeignItem(fi) => Some(&fi.attrs[]),
             NodeTraitItem(ref tm) => match **tm {
-                RequiredMethod(ref type_m) => Some(type_m.attrs.index(&FullRange)),
-                ProvidedMethod(ref m) => Some(m.attrs.index(&FullRange)),
-                TypeTraitItem(ref typ) => Some(typ.attrs.index(&FullRange)),
+                RequiredMethod(ref type_m) => Some(&type_m.attrs[]),
+                ProvidedMethod(ref m) => Some(&m.attrs[]),
+                TypeTraitItem(ref typ) => Some(&typ.attrs[]),
             },
             NodeImplItem(ref ii) => {
                 match **ii {
-                    MethodImplItem(ref m) => Some(m.attrs.index(&FullRange)),
-                    TypeImplItem(ref t) => Some(t.attrs.index(&FullRange)),
+                    MethodImplItem(ref m) => Some(&m.attrs[]),
+                    TypeImplItem(ref t) => Some(&t.attrs[]),
                 }
             }
-            NodeVariant(ref v) => Some(v.node.attrs.index(&FullRange)),
+            NodeVariant(ref v) => Some(&v.node.attrs[]),
             // unit/tuple structs take the attributes straight from
             // the struct definition.
             // FIXME(eddyb) make this work again (requires access to the map).
@@ -520,7 +520,7 @@ impl<'ast> Map<'ast> {
         NodesMatchingSuffix {
             map: self,
             item_name: parts.last().unwrap(),
-            in_which: parts.index(&(0..(parts.len() - 1))),
+            in_which: &parts[0..(parts.len() - 1)],
             idx: 0,
         }
     }
@@ -597,7 +597,7 @@ impl<'a, 'ast> NodesMatchingSuffix<'a, 'ast> {
                 None => return false,
                 Some((node_id, name)) => (node_id, name),
             };
-            if part.index(&FullRange) != mod_name.as_str() {
+            if &part[] != mod_name.as_str() {
                 return false;
             }
             cursor = self.map.get_parent(mod_id);
@@ -635,7 +635,7 @@ impl<'a, 'ast> NodesMatchingSuffix<'a, 'ast> {
     // We are looking at some node `n` with a given name and parent
     // id; do their names match what I am seeking?
     fn matches_names(&self, parent_of_n: NodeId, name: Name) -> bool {
-        name.as_str() == self.item_name.index(&FullRange) &&
+        name.as_str() == &self.item_name[] &&
             self.suffix_matches(parent_of_n)
     }
 }
@@ -1047,7 +1047,7 @@ impl<'a> NodePrinter for pprust::State<'a> {
 
 fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
     let id_str = format!(" (id={})", id);
-    let id_str = if include_id { id_str.index(&FullRange) } else { "" };
+    let id_str = if include_id { &id_str[] } else { "" };
 
     match map.find(id) {
         Some(NodeItem(item)) => {