impl LintPass for MinMaxPass {
fn get_lints(&self) -> LintArray {
- lint_array!(MIN_MAX)
+ lint_array!(MIN_MAX)
}
}
impl LateLintPass for MutMut {
fn check_expr(&mut self, cx: &LateContext, expr: &Expr) {
- check_expr_mut(cx, expr)
+ check_expr_mut(cx, expr)
}
fn check_ty(&mut self, cx: &LateContext, ty: &Ty) {
fn check_expr_mut(cx: &LateContext, expr: &Expr) {
if in_external_macro(cx, expr.span) { return; }
- fn unwrap_addr(expr : &Expr) -> Option<&Expr> {
+ fn unwrap_addr(expr: &Expr) -> Option<&Expr> {
match expr.node {
ExprAddrOf(MutMutable, ref e) => Option::Some(e),
_ => Option::None
})
}
-fn unwrap_mut(ty : &Ty) -> Option<&Ty> {
+fn unwrap_mut(ty: &Ty) -> Option<&Ty> {
match ty.node {
TyRptr(_, MutTy{ ty: ref pty, mutbl: MutMutable }) => Option::Some(pty),
_ => Option::None
match (fetch_bool_block(then_block), fetch_bool_expr(else_expr)) {
(Some(true), Some(true)) => {
span_lint(cx, NEEDLESS_BOOL, e.span,
- "this if-then-else expression will always return true"); }
+ "this if-then-else expression will always return true");
+ }
(Some(false), Some(false)) => {
span_lint(cx, NEEDLESS_BOOL, e.span,
- "this if-then-else expression will always return false"); }
+ "this if-then-else expression will always return false");
+ }
(Some(true), Some(false)) => {
let pred_snip = snippet(cx, pred.span, "..");
let hint = if pred_snip == ".." { "its predicate".into() } else {
use rustc::lint::*;
use rustc_front::hir::*;
-use utils::{span_lint};
+use utils::span_lint;
use utils;
declare_lint! {
impl LintPass for NeedlessFeaturesPass {
fn get_lints(&self) -> LintArray {
- lint_array!(UNSTABLE_AS_SLICE,UNSTABLE_AS_MUT_SLICE)
+ lint_array!(UNSTABLE_AS_SLICE, UNSTABLE_AS_MUT_SLICE)
}
}
method call. Consider adding parentheses \
to clarify your intent: -({})",
snippet(cx, rhs.span, ".."))),
- _ => ()
+ _ => ()
}
}
}
}
}
-fn is_arith_expr(expr : &Expr) -> bool {
+fn is_arith_expr(expr: &Expr) -> bool {
match expr.node {
ExprBinary(Spanned { node: op, ..}, _, _) => is_arith_op(op),
_ => false
}
}
-fn is_bit_op(op : BinOp_) -> bool {
+fn is_bit_op(op: BinOp_) -> bool {
match op {
BiBitXor | BiBitAnd | BiBitOr | BiShl | BiShr => true,
_ => false
}
}
-fn is_arith_op(op : BinOp_) -> bool {
+fn is_arith_op(op: BinOp_) -> bool {
match op {
BiAdd | BiSub | BiMul | BiDiv | BiRem => true,
_ => false
"you added something to a string. \
Consider using `String::push_str()` instead")
}
- } else if let &ExprAssign(ref target, ref src) = &e.node {
+ } else if let &ExprAssign(ref target, ref src) = &e.node {
if is_string(cx, target) && is_add(cx, src, target) {
span_lint(cx, STRING_ADD_ASSIGN, e.span,
"you assigned the result of adding something to this string. \
use rustc::lint::*;
use rustc_front::hir::*;
-use utils::{span_help_and_lint};
+use utils::span_help_and_lint;
use consts::{Constant, constant_simple, FloatWidth};
/// ZeroDivZeroPass is a pass that checks for a binary expression that consists