about summary refs log tree commit diff
path: root/src/librustc/lint/builtin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc/lint/builtin.rs')
-rw-r--r--src/librustc/lint/builtin.rs58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 9d7e833e711..7c210351f31 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -506,7 +506,7 @@ impl BoxPointers {
         if n_uniq > 0 {
             let s = ty_to_string(cx.tcx, ty);
             let m = format!("type uses owned (Box type) pointers: {}", s);
-            cx.span_lint(BOX_POINTERS, span, m.index(&FullRange));
+            cx.span_lint(BOX_POINTERS, span, &m[]);
         }
     }
 }
@@ -586,7 +586,7 @@ impl LintPass for RawPointerDerive {
     }
 
     fn check_item(&mut self, cx: &Context, item: &ast::Item) {
-        if !attr::contains_name(item.attrs.index(&FullRange), "automatically_derived") {
+        if !attr::contains_name(&item.attrs[], "automatically_derived") {
             return
         }
         let did = match item.node {
@@ -770,11 +770,11 @@ impl LintPass for UnusedResults {
             ty::ty_enum(did, _) => {
                 if ast_util::is_local(did) {
                     if let ast_map::NodeItem(it) = cx.tcx.map.get(did.node) {
-                        warned |= check_must_use(cx, it.attrs.index(&FullRange), s.span);
+                        warned |= check_must_use(cx, &it.attrs[], s.span);
                     }
                 } else {
                     csearch::get_item_attrs(&cx.sess().cstore, did, |attrs| {
-                        warned |= check_must_use(cx, attrs.index(&FullRange), s.span);
+                        warned |= check_must_use(cx, &attrs[], s.span);
                     });
                 }
             }
@@ -796,7 +796,7 @@ impl LintPass for UnusedResults {
                             msg.push_str(s.get());
                         }
                     }
-                    cx.span_lint(UNUSED_MUST_USE, sp, msg.index(&FullRange));
+                    cx.span_lint(UNUSED_MUST_USE, sp, &msg[]);
                     return true;
                 }
             }
@@ -842,7 +842,7 @@ impl NonCamelCaseTypes {
             } else {
                 format!("{} `{}` should have a camel case name such as `{}`", sort, s, c)
             };
-            cx.span_lint(NON_CAMEL_CASE_TYPES, span, m.index(&FullRange));
+            cx.span_lint(NON_CAMEL_CASE_TYPES, span, &m[]);
         }
     }
 }
@@ -981,8 +981,8 @@ impl NonSnakeCase {
 
         if !is_snake_case(ident) {
             cx.span_lint(NON_SNAKE_CASE, span,
-                format!("{} `{}` should have a snake case name such as `{}`",
-                        sort, s, to_snake_case(s.get())).index(&FullRange));
+                &format!("{} `{}` should have a snake case name such as `{}`",
+                        sort, s, to_snake_case(s.get()))[]);
         }
     }
 }
@@ -1066,10 +1066,10 @@ impl LintPass for NonUpperCaseGlobals {
                 // upper/lowercase)
                 if s.get().chars().any(|c| c.is_lowercase()) {
                     cx.span_lint(NON_UPPER_CASE_GLOBALS, it.span,
-                        format!("static constant `{}` should have an uppercase name \
+                        &format!("static constant `{}` should have an uppercase name \
                                  such as `{}`",
-                                s.get(), s.get().chars().map(|c| c.to_uppercase())
-                                .collect::<String>().index(&FullRange)).index(&FullRange));
+                                s.get(), &s.get().chars().map(|c| c.to_uppercase())
+                                .collect::<String>()[])[]);
                 }
             }
             _ => {}
@@ -1083,10 +1083,10 @@ impl LintPass for NonUpperCaseGlobals {
                 let s = token::get_ident(path1.node);
                 if s.get().chars().any(|c| c.is_lowercase()) {
                     cx.span_lint(NON_UPPER_CASE_GLOBALS, path1.span,
-                        format!("static constant in pattern `{}` should have an uppercase \
+                        &format!("static constant in pattern `{}` should have an uppercase \
                                  name such as `{}`",
-                                s.get(), s.get().chars().map(|c| c.to_uppercase())
-                                    .collect::<String>().index(&FullRange)).index(&FullRange));
+                                s.get(), &s.get().chars().map(|c| c.to_uppercase())
+                                    .collect::<String>()[])[]);
                 }
             }
             _ => {}
@@ -1110,8 +1110,8 @@ impl UnusedParens {
             let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&**inner);
             if !necessary {
                 cx.span_lint(UNUSED_PARENS, value.span,
-                             format!("unnecessary parentheses around {}",
-                                     msg).index(&FullRange))
+                             &format!("unnecessary parentheses around {}",
+                                     msg)[])
             }
         }
 
@@ -1213,7 +1213,7 @@ impl LintPass for UnusedImportBraces {
                                     let m = format!("braces around {} is unnecessary",
                                                     token::get_ident(*name).get());
                                     cx.span_lint(UNUSED_IMPORT_BRACES, view_item.span,
-                                                 m.index(&FullRange));
+                                                 &m[]);
                                 },
                                 _ => ()
                             }
@@ -1251,8 +1251,8 @@ impl LintPass for NonShorthandFieldPatterns {
                 if let ast::PatIdent(_, ident, None) = fieldpat.node.pat.node {
                     if ident.node.as_str() == fieldpat.node.ident.as_str() {
                         cx.span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span,
-                                     format!("the `{}:` in this pattern is redundant and can \
-                                              be removed", ident.node.as_str()).index(&FullRange))
+                                     &format!("the `{}:` in this pattern is redundant and can \
+                                              be removed", ident.node.as_str())[])
                     }
                 }
             }
@@ -1356,7 +1356,7 @@ impl LintPass for UnusedMut {
     fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
         if let ast::ExprMatch(_, ref arms, _) = e.node {
             for a in arms.iter() {
-                self.check_unused_mut_pat(cx, a.pats.index(&FullRange))
+                self.check_unused_mut_pat(cx, &a.pats[])
             }
         }
     }
@@ -1477,7 +1477,7 @@ impl MissingDoc {
         });
         if !has_doc {
             cx.span_lint(MISSING_DOCS, sp,
-                format!("missing documentation for {}", desc).index(&FullRange));
+                &format!("missing documentation for {}", desc)[]);
         }
     }
 }
@@ -1491,7 +1491,7 @@ impl LintPass for MissingDoc {
         let doc_hidden = self.doc_hidden() || attrs.iter().any(|attr| {
             attr.check_name("doc") && match attr.meta_item_list() {
                 None => false,
-                Some(l) => attr::contains_name(l.index(&FullRange), "hidden"),
+                Some(l) => attr::contains_name(&l[], "hidden"),
             }
         });
         self.doc_hidden_stack.push(doc_hidden);
@@ -1513,7 +1513,7 @@ impl LintPass for MissingDoc {
     }
 
     fn check_crate(&mut self, cx: &Context, krate: &ast::Crate) {
-        self.check_missing_docs_attrs(cx, None, krate.attrs.index(&FullRange),
+        self.check_missing_docs_attrs(cx, None, &krate.attrs[],
                                      krate.span, "crate");
     }
 
@@ -1527,7 +1527,7 @@ impl LintPass for MissingDoc {
             ast::ItemTy(..) => "a type alias",
             _ => return
         };
-        self.check_missing_docs_attrs(cx, Some(it.id), it.attrs.index(&FullRange),
+        self.check_missing_docs_attrs(cx, Some(it.id), &it.attrs[],
                                      it.span, desc);
     }
 
@@ -1540,13 +1540,13 @@ impl LintPass for MissingDoc {
 
             // Otherwise, doc according to privacy. This will also check
             // doc for default methods defined on traits.
-            self.check_missing_docs_attrs(cx, Some(m.id), m.attrs.index(&FullRange),
+            self.check_missing_docs_attrs(cx, Some(m.id), &m.attrs[],
                                           m.span, "a method");
         }
     }
 
     fn check_ty_method(&mut self, cx: &Context, tm: &ast::TypeMethod) {
-        self.check_missing_docs_attrs(cx, Some(tm.id), tm.attrs.index(&FullRange),
+        self.check_missing_docs_attrs(cx, Some(tm.id), &tm.attrs[],
                                      tm.span, "a type method");
     }
 
@@ -1556,14 +1556,14 @@ impl LintPass for MissingDoc {
                 let cur_struct_def = *self.struct_def_stack.last()
                     .expect("empty struct_def_stack");
                 self.check_missing_docs_attrs(cx, Some(cur_struct_def),
-                                              sf.node.attrs.index(&FullRange), sf.span,
+                                              &sf.node.attrs[], sf.span,
                                               "a struct field")
             }
         }
     }
 
     fn check_variant(&mut self, cx: &Context, v: &ast::Variant, _: &ast::Generics) {
-        self.check_missing_docs_attrs(cx, Some(v.node.id), v.node.attrs.index(&FullRange),
+        self.check_missing_docs_attrs(cx, Some(v.node.id), &v.node.attrs[],
                                      v.span, "a variant");
         assert!(!self.in_variant);
         self.in_variant = true;
@@ -1693,7 +1693,7 @@ impl Stability {
                 _ => format!("use of {} item", label)
             };
 
-            cx.span_lint(lint, span, msg.index(&FullRange));
+            cx.span_lint(lint, span, &msg[]);
         }
     }