From 1d602d0f124904f91d6d934e83a8a687f314e110 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Tue, 17 Nov 2015 14:22:57 +0900 Subject: [PATCH] rustfmt a little --- src/minmax.rs | 2 +- src/mut_mut.rs | 6 +++--- src/needless_bool.rs | 6 ++++-- src/needless_features.rs | 4 ++-- src/precedence.rs | 8 ++++---- src/strings.rs | 2 +- src/zero_div_zero.rs | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/minmax.rs b/src/minmax.rs index 7ed651847275..9eb8a030e153 100644 --- a/src/minmax.rs +++ b/src/minmax.rs @@ -17,7 +17,7 @@ pub struct MinMaxPass; impl LintPass for MinMaxPass { fn get_lints(&self) -> LintArray { - lint_array!(MIN_MAX) + lint_array!(MIN_MAX) } } diff --git a/src/mut_mut.rs b/src/mut_mut.rs index 9b6a5d9ddcc7..a92338165dd3 100644 --- a/src/mut_mut.rs +++ b/src/mut_mut.rs @@ -19,7 +19,7 @@ impl LintPass for MutMut { 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) { @@ -31,7 +31,7 @@ impl LateLintPass for MutMut { 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 @@ -53,7 +53,7 @@ fn check_expr_mut(cx: &LateContext, expr: &Expr) { }) } -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 diff --git a/src/needless_bool.rs b/src/needless_bool.rs index 52f23c7518a6..e4d3b00218ed 100644 --- a/src/needless_bool.rs +++ b/src/needless_bool.rs @@ -31,10 +31,12 @@ impl LateLintPass for NeedlessBool { 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 { diff --git a/src/needless_features.rs b/src/needless_features.rs index b1d38df73113..44db5e922213 100644 --- a/src/needless_features.rs +++ b/src/needless_features.rs @@ -5,7 +5,7 @@ use rustc::lint::*; use rustc_front::hir::*; -use utils::{span_lint}; +use utils::span_lint; use utils; declare_lint! { @@ -27,7 +27,7 @@ pub struct NeedlessFeaturesPass; 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) } } diff --git a/src/precedence.rs b/src/precedence.rs index b7dbe2685573..b659bd647a7c 100644 --- a/src/precedence.rs +++ b/src/precedence.rs @@ -53,7 +53,7 @@ impl EarlyLintPass for Precedence { method call. Consider adding parentheses \ to clarify your intent: -({})", snippet(cx, rhs.span, ".."))), - _ => () + _ => () } } } @@ -62,21 +62,21 @@ impl EarlyLintPass for Precedence { } } -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 diff --git a/src/strings.rs b/src/strings.rs index 6bbf94004b0e..082746575382 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -51,7 +51,7 @@ impl LateLintPass for StringAdd { "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. \ diff --git a/src/zero_div_zero.rs b/src/zero_div_zero.rs index 37d5d8904e12..484348c5a37f 100644 --- a/src/zero_div_zero.rs +++ b/src/zero_div_zero.rs @@ -1,7 +1,7 @@ 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