]> git.lizzy.rs Git - rust.git/commitdiff
s/cx.span_lint/span_lint(cx, /
authormcarton <cartonmartin+git@gmail.com>
Sat, 26 Mar 2016 00:49:45 +0000 (01:49 +0100)
committermcarton <cartonmartin+git@gmail.com>
Mon, 28 Mar 2016 16:05:43 +0000 (18:05 +0200)
src/misc.rs
src/ranges.rs

index 49426d5d5de351554f92a9ef8580e7d9a8ec249e..5a787ba6dbaf1e08c14e604274f37b4c91056b9e 100644 (file)
@@ -312,7 +312,7 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
         if let ExprBinary(ref cmp, _, ref right) = expr.node {
             if let Spanned {node: BinOp_::BiRem, ..} = *cmp {
                 if is_integer_literal(right, 1) {
-                    cx.span_lint(MODULO_ONE, expr.span, "any number modulo 1 will be 0");
+                    span_lint(cx, MODULO_ONE, expr.span, "any number modulo 1 will be 0");
                 }
             }
         }
@@ -347,11 +347,12 @@ impl LateLintPass for PatternPass {
     fn check_pat(&mut self, cx: &LateContext, pat: &Pat) {
         if let PatKind::Ident(_, ref ident, Some(ref right)) = pat.node {
             if right.node == PatKind::Wild {
-                cx.span_lint(REDUNDANT_PATTERN,
-                             pat.span,
-                             &format!("the `{} @ _` pattern can be written as just `{}`",
-                                      ident.node.name,
-                                      ident.node.name));
+                span_lint(cx,
+                          REDUNDANT_PATTERN,
+                          pat.span,
+                          &format!("the `{} @ _` pattern can be written as just `{}`",
+                                   ident.node.name,
+                                   ident.node.name));
             }
         }
     }
@@ -408,10 +409,11 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
             _ => false,
         };
         if needs_lint {
-            cx.span_lint(USED_UNDERSCORE_BINDING,
-                         expr.span,
-                         "used binding which is prefixed with an underscore. A leading underscore signals that a \
-                          binding will not be used.");
+            span_lint(cx,
+                      USED_UNDERSCORE_BINDING,
+                      expr.span,
+                      "used binding which is prefixed with an underscore. A leading underscore signals that a \
+                       binding will not be used.");
         }
     }
 }
index 766d98b4e0b9fd331d07148855ce321e928f4229..23bd3d1103cef27bb60d9fc7a11c43dbff3ee1f6 100644 (file)
@@ -1,7 +1,7 @@
 use rustc::lint::*;
 use rustc_front::hir::*;
 use syntax::codemap::Spanned;
-use utils::{is_integer_literal, match_type, snippet, unsugar_range, UnsugaredRange};
+use utils::{is_integer_literal, match_type, snippet, span_lint, unsugar_range, UnsugaredRange};
 
 /// **What it does:** This lint checks for iterating over ranges with a `.step_by(0)`, which never terminates.
 ///
@@ -41,10 +41,11 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
             // Range with step_by(0).
             if name.as_str() == "step_by" && args.len() == 2 && is_range(cx, &args[0]) &&
                is_integer_literal(&args[1], 0) {
-                cx.span_lint(RANGE_STEP_BY_ZERO,
-                             expr.span,
-                             "Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` \
-                              instead")
+                span_lint(cx,
+                          RANGE_STEP_BY_ZERO,
+                          expr.span,
+                          "Range::step_by(0) produces an infinite iterator. Consider using `std::iter::repeat()` \
+                           instead");
             } else if name.as_str() == "zip" && args.len() == 2 {
                 let iter = &args[0].node;
                 let zip_arg = &args[1];
@@ -64,9 +65,11 @@ fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
                         let ExprPath(_, Path { segments: ref len_path, .. }) = len_args[0].node,
                         iter_path == len_path
                      ], {
-                        cx.span_lint(RANGE_ZIP_WITH_LEN, expr.span,
-                                     &format!("It is more idiomatic to use {}.iter().enumerate()",
-                                              snippet(cx, iter_args[0].span, "_")));
+                        span_lint(cx,
+                                  RANGE_ZIP_WITH_LEN,
+                                  expr.span,
+                                  &format!("It is more idiomatic to use {}.iter().enumerate()",
+                                           snippet(cx, iter_args[0].span, "_")));
                     }
                 }
             }