about summary refs log tree commit diff
path: root/src/libsyntax/ast_map/mod.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-01-02 13:56:28 +1300
committerNick Cameron <ncameron@mozilla.com>2015-01-07 10:46:33 +1300
commitf7ff37e4c52a1d6562635fcd5bab6309cf75ea08 (patch)
tree9c69736bf3830f9048f61d45943bf0fa6326782d /src/libsyntax/ast_map/mod.rs
parent918255ef8c3c21b2009204c3019239f8dc9f46bf (diff)
downloadrust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.tar.gz
rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.zip
Replace full slice notation with index calls
Diffstat (limited to 'src/libsyntax/ast_map/mod.rs')
-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 cf09e2777f7..efd35f73d45 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -99,7 +99,7 @@ pub fn path_to_string<PI: Iterator<Item=PathElem>>(path: PI) -> String {
         if !s.is_empty() {
             s.push_str("::");
         }
-        s.push_str(e[]);
+        s.push_str(e.index(&FullRange));
         s
     }).to_string()
 }
@@ -476,20 +476,20 @@ impl<'ast> Map<'ast> {
         F: FnOnce(Option<&[Attribute]>) -> T,
     {
         let attrs = match self.get(id) {
-            NodeItem(i) => Some(i.attrs[]),
-            NodeForeignItem(fi) => Some(fi.attrs[]),
+            NodeItem(i) => Some(i.attrs.index(&FullRange)),
+            NodeForeignItem(fi) => Some(fi.attrs.index(&FullRange)),
             NodeTraitItem(ref tm) => match **tm {
-                RequiredMethod(ref type_m) => Some(type_m.attrs[]),
-                ProvidedMethod(ref m) => Some(m.attrs[]),
-                TypeTraitItem(ref typ) => Some(typ.attrs[]),
+                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)),
             },
             NodeImplItem(ref ii) => {
                 match **ii {
-                    MethodImplItem(ref m) => Some(m.attrs[]),
-                    TypeImplItem(ref t) => Some(t.attrs[]),
+                    MethodImplItem(ref m) => Some(m.attrs.index(&FullRange)),
+                    TypeImplItem(ref t) => Some(t.attrs.index(&FullRange)),
                 }
             }
-            NodeVariant(ref v) => Some(v.node.attrs[]),
+            NodeVariant(ref v) => Some(v.node.attrs.index(&FullRange)),
             // unit/tuple structs take the attributes straight from
             // the struct definition.
             // FIXME(eddyb) make this work again (requires access to the map).
@@ -513,7 +513,7 @@ impl<'ast> Map<'ast> {
         NodesMatchingSuffix {
             map: self,
             item_name: parts.last().unwrap(),
-            in_which: parts[..parts.len() - 1],
+            in_which: parts.index(&(0..(parts.len() - 1))),
             idx: 0,
         }
     }
@@ -590,7 +590,7 @@ impl<'a, 'ast> NodesMatchingSuffix<'a, 'ast> {
                 None => return false,
                 Some((node_id, name)) => (node_id, name),
             };
-            if part[] != mod_name.as_str() {
+            if part.index(&FullRange) != mod_name.as_str() {
                 return false;
             }
             cursor = self.map.get_parent(mod_id);
@@ -628,7 +628,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[] &&
+        name.as_str() == self.item_name.index(&FullRange) &&
             self.suffix_matches(parent_of_n)
     }
 }
@@ -1040,7 +1040,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[] } else { "" };
+    let id_str = if include_id { id_str.index(&FullRange) } else { "" };
 
     match map.find(id) {
         Some(NodeItem(item)) => {