None,
}
}
diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs
index 6ccdb6ee1459..a195673a53bc 100644
--- a/clippy_lints/src/non_expressive_names.rs
+++ b/clippy_lints/src/non_expressive_names.rs
@@ -88,7 +88,7 @@ impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
self.visit_pat(&field.node.pat);
}
}
- }
+ },
_ => walk_pat(self, pat),
}
}
@@ -210,8 +210,8 @@ impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> {
diag.span_help(span,
&format!("separate the discriminating character by an \
underscore like: `{}_{}`",
- &interned_name[..split],
- &interned_name[split..]));
+ &interned_name[..split],
+ &interned_name[split..]));
}
});
return;
@@ -241,7 +241,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
if let Some(ref init) = local.init {
self.apply(|this| walk_expr(this, &**init));
}
- // add the pattern after the expression because the bindings aren't available yet in the init expression
+ // add the pattern after the expression because the bindings aren't available yet in the init
+ // expression
SimilarNamesNameVisitor(self).visit_pat(&*local.pat);
}
fn visit_block(&mut self, blk: &'tcx Block) {
@@ -249,7 +250,8 @@ impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
}
fn visit_arm(&mut self, arm: &'tcx Arm) {
self.apply(|this| {
- // just go through the first pattern, as either all patterns bind the same bindings or rustc would have errored much earlier
+ // just go through the first pattern, as either all patterns
+ // bind the same bindings or rustc would have errored much earlier
SimilarNamesNameVisitor(this).visit_pat(&arm.pats[0]);
this.apply(|this| walk_expr(this, &arm.body));
});
diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs
index 6ac49c1f575d..65b13688ff62 100644
--- a/clippy_lints/src/ok_if_let.rs
+++ b/clippy_lints/src/ok_if_let.rs
@@ -15,7 +15,7 @@ use utils::{paths, method_chain_args, span_help_and_lint, match_type, snippet};
/// vec.push(bench)
/// }
/// }
-///```
+/// ```
/// Could be written:
///
/// ```rust
diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs
index f102bdcab33d..4216345e48e7 100644
--- a/clippy_lints/src/open_options.rs
+++ b/clippy_lints/src/open_options.rs
@@ -71,36 +71,32 @@ fn get_open_options(cx: &LateContext, argument: &Expr, options: &mut Vec<(OpenOp
let argument_option = match arguments[1].node {
ExprLit(ref span) => {
if let Spanned { node: LitKind::Bool(lit), .. } = **span {
- if lit {
- Argument::True
- } else {
- Argument::False
- }
+ if lit { Argument::True } else { Argument::False }
} else {
return; // The function is called with a literal
// which is not a boolean literal. This is theoretically
// possible, but not very likely.
}
- }
+ },
_ => Argument::Unknown,
};
match &*name.node.as_str() {
"create" => {
options.push((OpenOption::Create, argument_option));
- }
+ },
"append" => {
options.push((OpenOption::Append, argument_option));
- }
+ },
"truncate" => {
options.push((OpenOption::Truncate, argument_option));
- }
+ },
"read" => {
options.push((OpenOption::Read, argument_option));
- }
+ },
"write" => {
options.push((OpenOption::Write, argument_option));
- }
+ },
_ => (),
}
@@ -111,11 +107,8 @@ fn get_open_options(cx: &LateContext, argument: &Expr, options: &mut Vec<(OpenOp
fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span: Span) {
let (mut create, mut append, mut truncate, mut read, mut write) = (false, false, false, false, false);
- let (mut create_arg, mut append_arg, mut truncate_arg, mut read_arg, mut write_arg) = (false,
- false,
- false,
- false,
- false);
+ let (mut create_arg, mut append_arg, mut truncate_arg, mut read_arg, mut write_arg) =
+ (false, false, false, false, false);
// This code is almost duplicated (oh, the irony), but I haven't found a way to unify it.
for option in options {
@@ -130,7 +123,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
create = true
}
create_arg = create_arg || (arg == Argument::True);;
- }
+ },
(OpenOption::Append, arg) => {
if append {
span_lint(cx,
@@ -141,7 +134,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
append = true
}
append_arg = append_arg || (arg == Argument::True);;
- }
+ },
(OpenOption::Truncate, arg) => {
if truncate {
span_lint(cx,
@@ -152,7 +145,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
truncate = true
}
truncate_arg = truncate_arg || (arg == Argument::True);
- }
+ },
(OpenOption::Read, arg) => {
if read {
span_lint(cx,
@@ -163,7 +156,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
read = true
}
read_arg = read_arg || (arg == Argument::True);;
- }
+ },
(OpenOption::Write, arg) => {
if write {
span_lint(cx,
@@ -174,7 +167,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
write = true
}
write_arg = write_arg || (arg == Argument::True);;
- }
+ },
}
}
diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs
index a09ff3bebf68..f2e478865497 100644
--- a/clippy_lints/src/overflow_check_conditional.rs
+++ b/clippy_lints/src/overflow_check_conditional.rs
@@ -44,12 +44,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {
], {
if let BinOp_::BiLt = op.node {
if let BinOp_::BiAdd = op2.node {
- span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span, "You are trying to use classic C overflow conditions that will fail in Rust.");
+ span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
+ "You are trying to use classic C overflow conditions that will fail in Rust.");
}
}
if let BinOp_::BiGt = op.node {
if let BinOp_::BiSub = op2.node {
- span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span, "You are trying to use classic C underflow conditions that will fail in Rust.");
+ span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
+ "You are trying to use classic C underflow conditions that will fail in Rust.");
}
}
}}
@@ -66,12 +68,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {
], {
if let BinOp_::BiGt = op.node {
if let BinOp_::BiAdd = op2.node {
- span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span, "You are trying to use classic C overflow conditions that will fail in Rust.");
+ span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
+ "You are trying to use classic C overflow conditions that will fail in Rust.");
}
}
if let BinOp_::BiLt = op.node {
if let BinOp_::BiSub = op2.node {
- span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span, "You are trying to use classic C underflow conditions that will fail in Rust.");
+ span_lint(cx, OVERFLOW_CHECK_CONDITIONAL, expr.span,
+ "You are trying to use classic C underflow conditions that will fail in Rust.");
}
}
}}
diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs
index 1d10fb19c733..146706646ae4 100644
--- a/clippy_lints/src/precedence.rs
+++ b/clippy_lints/src/precedence.rs
@@ -49,7 +49,7 @@ impl EarlyLintPass for Precedence {
snippet(cx, left.span, ".."),
op.to_string(),
snippet(cx, right.span, "..")));
- }
+ },
(true, false) => {
span_lint(cx,
PRECEDENCE,
@@ -59,7 +59,7 @@ impl EarlyLintPass for Precedence {
snippet(cx, left.span, ".."),
op.to_string(),
snippet(cx, right.span, "..")));
- }
+ },
(false, true) => {
span_lint(cx,
PRECEDENCE,
@@ -69,7 +69,7 @@ impl EarlyLintPass for Precedence {
snippet(cx, left.span, ".."),
op.to_string(),
snippet(cx, right.span, "..")));
- }
+ },
_ => (),
}
}
@@ -88,7 +88,7 @@ impl EarlyLintPass for Precedence {
&format!("unary minus has lower precedence than method call. Consider \
adding parentheses to clarify your intent: -({})",
snippet(cx, rhs.span, "..")));
- }
+ },
_ => (),
}
}
diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs
index 1461189946c1..2f74390cc73e 100644
--- a/clippy_lints/src/ptr.rs
+++ b/clippy_lints/src/ptr.rs
@@ -117,7 +117,7 @@ fn is_null_path(expr: &Expr) -> bool {
if let ExprCall(ref pathexp, ref args) = expr.node {
if args.is_empty() {
if let ExprPath(ref path) = pathexp.node {
- return match_path(path, &paths::PTR_NULL) || match_path(path, &paths::PTR_NULL_MUT)
+ return match_path(path, &paths::PTR_NULL) || match_path(path, &paths::PTR_NULL_MUT);
}
}
}
diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs
index 78f097002039..01829ffea45b 100644
--- a/clippy_lints/src/ranges.rs
+++ b/clippy_lints/src/ranges.rs
@@ -52,8 +52,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StepByZero {
let name = &*name.as_str();
// Range with step_by(0).
- if name == "step_by" && args.len() == 2 && has_step_by(cx, &args[0]) &&
- is_integer_literal(&args[1], 0) {
+ if name == "step_by" && args.len() == 2 && has_step_by(cx, &args[0]) && is_integer_literal(&args[1], 0) {
span_lint(cx,
RANGE_STEP_BY_ZERO,
expr.span,
@@ -94,7 +93,6 @@ fn has_step_by(cx: &LateContext, expr: &Expr) -> bool {
let ty = cx.tcx.tables().expr_ty(expr);
// Note: `RangeTo`, `RangeToInclusive` and `RangeFull` don't have step_by
- match_type(cx, ty, &paths::RANGE)
- || match_type(cx, ty, &paths::RANGE_FROM)
- || match_type(cx, ty, &paths::RANGE_INCLUSIVE)
+ match_type(cx, ty, &paths::RANGE) || match_type(cx, ty, &paths::RANGE_FROM) ||
+ match_type(cx, ty, &paths::RANGE_INCLUSIVE)
}
diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs
index 19e8a3c7d146..7c5c5713550a 100644
--- a/clippy_lints/src/reference.rs
+++ b/clippy_lints/src/reference.rs
@@ -1,4 +1,4 @@
-use syntax::ast::{Expr,ExprKind,UnOp};
+use syntax::ast::{Expr, ExprKind, UnOp};
use rustc::lint::*;
use utils::{span_lint_and_then, snippet};
@@ -40,15 +40,9 @@ impl EarlyLintPass for Pass {
fn check_expr(&mut self, cx: &EarlyContext, e: &Expr) {
if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.node {
if let ExprKind::AddrOf(_, ref addrof_target) = without_parens(deref_target).node {
- span_lint_and_then(
- cx,
- DEREF_ADDROF,
- e.span,
- "immediately dereferencing a reference",
- |db| {
- db.span_suggestion(e.span, "try this",
- format!("{}", snippet(cx, addrof_target.span, "_")));
- });
+ span_lint_and_then(cx, DEREF_ADDROF, e.span, "immediately dereferencing a reference", |db| {
+ db.span_suggestion(e.span, "try this", format!("{}", snippet(cx, addrof_target.span, "_")));
+ });
}
}
}
diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs
index 6e6b6156d6e6..31ac194ca7bf 100644
--- a/clippy_lints/src/regex.rs
+++ b/clippy_lints/src/regex.rs
@@ -145,7 +145,7 @@ fn str_span(base: Span, s: &str, c: usize) -> Span {
hi: base.lo + BytePos(h as u32),
..base
}
- }
+ },
_ => base,
}
}
@@ -172,17 +172,18 @@ fn is_trivial_regex(s: ®ex_syntax::Expr) -> Option<&'static str> {
(&Expr::Literal { .. }, &Expr::EndText) => Some("consider using `str::ends_with`"),
_ => None,
}
- }
+ },
3 => {
- if let (&Expr::StartText, &Expr::Literal {..}, &Expr::EndText) = (&exprs[0], &exprs[1], &exprs[2]) {
+ if let (&Expr::StartText, &Expr::Literal { .. }, &Expr::EndText) =
+ (&exprs[0], &exprs[1], &exprs[2]) {
Some("consider using `==` on `str`s")
} else {
None
}
- }
+ },
_ => None,
}
- }
+ },
_ => None,
}
}
@@ -213,14 +214,13 @@ fn check_regex(cx: &LateContext, expr: &Expr, utf8: bool) {
"trivial regex",
&format!("consider using {}", repl));
}
- }
+ },
Err(e) => {
span_lint(cx,
INVALID_REGEX,
str_span(expr.span, r, e.position()),
- &format!("regex syntax error: {}",
- e.description()));
- }
+ &format!("regex syntax error: {}", e.description()));
+ },
}
}
} else if let Some(r) = const_str(cx, expr) {
@@ -233,15 +233,13 @@ fn check_regex(cx: &LateContext, expr: &Expr, utf8: bool) {
"trivial regex",
&format!("consider using {}", repl));
}
- }
+ },
Err(e) => {
span_lint(cx,
INVALID_REGEX,
expr.span,
- &format!("regex syntax error on position {}: {}",
- e.position(),
- e.description()));
- }
+ &format!("regex syntax error on position {}: {}", e.position(), e.description()));
+ },
}
}
}
diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs
index d79913b2c15b..b9054f72164b 100644
--- a/clippy_lints/src/returns.rs
+++ b/clippy_lints/src/returns.rs
@@ -48,9 +48,10 @@ impl ReturnPass {
fn check_block_return(&mut self, cx: &EarlyContext, block: &ast::Block) {
if let Some(stmt) = block.stmts.last() {
match stmt.node {
- ast::StmtKind::Expr(ref expr) | ast::StmtKind::Semi(ref expr) => {
+ ast::StmtKind::Expr(ref expr) |
+ ast::StmtKind::Semi(ref expr) => {
self.check_final_expr(cx, expr, Some(stmt.span));
- }
+ },
_ => (),
}
}
@@ -65,24 +66,24 @@ impl ReturnPass {
if !expr.attrs.iter().any(attr_is_cfg) {
self.emit_return_lint(cx, span.expect("`else return` is not possible"), inner.span);
}
- }
+ },
// a whole block? check it!
ast::ExprKind::Block(ref block) => {
self.check_block_return(cx, block);
- }
+ },
// an if/if let expr, check both exprs
// note, if without else is going to be a type checking error anyways
// (except for unit type functions) so we don't match it
ast::ExprKind::If(_, ref ifblock, Some(ref elsexpr)) => {
self.check_block_return(cx, ifblock);
self.check_final_expr(cx, elsexpr, None);
- }
+ },
// a match expr, check all arms
ast::ExprKind::Match(_, ref arms) => {
for arm in arms {
self.check_final_expr(cx, &arm.body, Some(arm.body.span));
}
- }
+ },
_ => (),
}
}
@@ -135,7 +136,8 @@ impl LintPass for ReturnPass {
impl EarlyLintPass for ReturnPass {
fn check_fn(&mut self, cx: &EarlyContext, kind: FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) {
match kind {
- FnKind::ItemFn(.., block) | FnKind::Method(.., block) => self.check_block_return(cx, block),
+ FnKind::ItemFn(.., block) |
+ FnKind::Method(.., block) => self.check_block_return(cx, block),
FnKind::Closure(body) => self.check_final_expr(cx, body, None),
}
}
@@ -152,4 +154,3 @@ fn attr_is_cfg(attr: &ast::Attribute) -> bool {
false
}
}
-
diff --git a/clippy_lints/src/serde.rs b/clippy_lints/src/serde.rs
index ec4bce557061..02faf7a204fb 100644
--- a/clippy_lints/src/serde.rs
+++ b/clippy_lints/src/serde.rs
@@ -46,8 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde {
span_lint(cx,
SERDE_API_MISUSE,
span,
- "you should not implement `visit_string` without also implementing `visit_str`",
- );
+ "you should not implement `visit_string` without also implementing `visit_str`");
}
}
}
diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs
index 2d32a8792741..9c5b032f6251 100644
--- a/clippy_lints/src/shadow.rs
+++ b/clippy_lints/src/shadow.rs
@@ -87,7 +87,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
decl: &'tcx FnDecl,
expr: &'tcx Expr,
_: Span,
- _: NodeId,
+ _: NodeId
) {
if in_external_macro(cx, expr.span) {
return;
@@ -155,7 +155,7 @@ fn check_pat<'a, 'tcx>(
pat: &'tcx Pat,
init: Option<&'tcx Expr>,
span: Span,
- bindings: &mut Vec<(Name, Span)>,
+ bindings: &mut Vec<(Name, Span)>
) {
// TODO: match more stuff / destructuring
match pat.node {
@@ -178,15 +178,15 @@ fn check_pat<'a, 'tcx>(
if let Some(ref p) = *inner {
check_pat(cx, p, init, span, bindings);
}
- }
+ },
PatKind::Struct(_, ref pfields, _) => {
if let Some(init_struct) = init {
if let ExprStruct(_, ref efields, _) = init_struct.node {
for field in pfields {
let name = field.node.name;
let efield = efields.iter()
- .find(|f| f.name.node == name)
- .map(|f| &*f.expr);
+ .find(|f| f.name.node == name)
+ .map(|f| &*f.expr);
check_pat(cx, &field.node.pat, efield, span, bindings);
}
} else {
@@ -199,7 +199,7 @@ fn check_pat<'a, 'tcx>(
check_pat(cx, &field.node.pat, None, span, bindings);
}
}
- }
+ },
PatKind::Tuple(ref inner, _) => {
if let Some(init_tup) = init {
if let ExprTup(ref tup) = init_tup.node {
@@ -216,7 +216,7 @@ fn check_pat<'a, 'tcx>(
check_pat(cx, p, None, span, bindings);
}
}
- }
+ },
PatKind::Box(ref inner) => {
if let Some(initp) = init {
if let ExprBox(ref inner_init) = initp.node {
@@ -227,7 +227,7 @@ fn check_pat<'a, 'tcx>(
} else {
check_pat(cx, inner, init, span, bindings);
}
- }
+ },
PatKind::Ref(ref inner, _) => check_pat(cx, inner, init, span, bindings),
// PatVec(Vec>, Option
>, Vec
>),
_ => (),
@@ -240,7 +240,7 @@ fn lint_shadow<'a, 'tcx: 'a>(
span: Span,
pattern_span: Span,
init: Option<&'tcx Expr>,
- prev_span: Span,
+ prev_span: Span
) {
if let Some(expr) = init {
if is_self_shadow(name, expr) {
@@ -250,8 +250,9 @@ fn lint_shadow<'a, 'tcx: 'a>(
&format!("`{}` is shadowed by itself in `{}`",
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")),
- |db| { db.span_note(prev_span, "previous binding is here"); },
- );
+ |db| {
+ db.span_note(prev_span, "previous binding is here");
+ });
} else if contains_self(cx, name, expr) {
span_lint_and_then(cx,
SHADOW_REUSE,
@@ -260,9 +261,9 @@ fn lint_shadow<'a, 'tcx: 'a>(
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")),
|db| {
- db.span_note(expr.span, "initialization happens here");
- db.span_note(prev_span, "previous binding is here");
- });
+ db.span_note(expr.span, "initialization happens here");
+ db.span_note(prev_span, "previous binding is here");
+ });
} else {
span_lint_and_then(cx,
SHADOW_UNRELATED,
@@ -271,9 +272,9 @@ fn lint_shadow<'a, 'tcx: 'a>(
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")),
|db| {
- db.span_note(expr.span, "initialization happens here");
- db.span_note(prev_span, "previous binding is here");
- });
+ db.span_note(expr.span, "initialization happens here");
+ db.span_note(prev_span, "previous binding is here");
+ });
}
} else {
@@ -281,7 +282,9 @@ fn lint_shadow<'a, 'tcx: 'a>(
SHADOW_UNRELATED,
span,
&format!("`{}` shadows a previous declaration", snippet(cx, pattern_span, "_")),
- |db| { db.span_note(prev_span, "previous binding is here"); });
+ |db| {
+ db.span_note(prev_span, "previous binding is here");
+ });
}
}
@@ -303,18 +306,18 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings:
for e in v {
check_expr(cx, e, bindings)
}
- }
+ },
ExprIf(ref cond, ref then, ref otherwise) => {
check_expr(cx, cond, bindings);
check_block(cx, then, bindings);
if let Some(ref o) = *otherwise {
check_expr(cx, o, bindings);
}
- }
+ },
ExprWhile(ref cond, ref block, _) => {
check_expr(cx, cond, bindings);
check_block(cx, block, bindings);
- }
+ },
ExprMatch(ref init, ref arms, _) => {
check_expr(cx, init, bindings);
let len = bindings.len();
@@ -329,7 +332,7 @@ fn check_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, bindings:
bindings.truncate(len);
}
}
- }
+ },
_ => (),
}
}
@@ -341,14 +344,14 @@ fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut V
TyArray(ref fty, ref expr) => {
check_ty(cx, fty, bindings);
check_expr(cx, expr, bindings);
- }
+ },
TyPtr(MutTy { ty: ref mty, .. }) |
TyRptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
TyTup(ref tup) => {
for t in tup {
check_ty(cx, t, bindings)
}
- }
+ },
TyTypeof(ref expr) => check_expr(cx, expr, bindings),
_ => (),
}
@@ -360,7 +363,7 @@ fn is_self_shadow(name: Name, expr: &Expr) -> bool {
ExprAddrOf(_, ref inner) => is_self_shadow(name, inner),
ExprBlock(ref block) => {
block.stmts.is_empty() && block.expr.as_ref().map_or(false, |e| is_self_shadow(name, e))
- }
+ },
ExprUnary(op, ref inner) => (UnDeref == op) && is_self_shadow(name, inner),
ExprPath(QPath::Resolved(_, ref path)) => path_eq_name(name, path),
_ => false,
diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs
index 01f2f66c2fde..195b49c72f68 100644
--- a/clippy_lints/src/strings.rs
+++ b/clippy_lints/src/strings.rs
@@ -122,7 +122,7 @@ fn is_add(cx: &LateContext, src: &Expr, target: &Expr) -> bool {
ExprBinary(Spanned { node: BiAdd, .. }, ref left, _) => SpanlessEq::new(cx).eq_expr(target, left),
ExprBlock(ref block) => {
block.stmts.is_empty() && block.expr.as_ref().map_or(false, |expr| is_add(cx, expr, target))
- }
+ },
_ => false,
}
}
@@ -152,11 +152,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes {
e.span,
"calling `as_bytes()` on a string literal",
|db| {
- let sugg = format!("b{}", snippet(cx, args[0].span, r#""foo""#));
- db.span_suggestion(e.span,
- "consider using a byte string literal instead",
- sugg);
- });
+ let sugg = format!("b{}", snippet(cx, args[0].span, r#""foo""#));
+ db.span_suggestion(e.span, "consider using a byte string literal instead", sugg);
+ });
}
}
diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs
index 7393ee3890e5..8ed7e3558797 100644
--- a/clippy_lints/src/swap.rs
+++ b/clippy_lints/src/swap.rs
@@ -81,7 +81,11 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
SpanlessEq::new(cx).ignore_fn().eq_expr(tmp_init, lhs1),
SpanlessEq::new(cx).ignore_fn().eq_expr(rhs1, lhs2)
], {
- fn check_for_slice<'a>(cx: &LateContext, lhs1: &'a Expr, lhs2: &'a Expr) -> Option<(&'a Expr, &'a Expr, &'a Expr)> {
+ fn check_for_slice<'a>(
+ cx: &LateContext,
+ lhs1: &'a Expr,
+ lhs2: &'a Expr,
+ ) -> Option<(&'a Expr, &'a Expr, &'a Expr)> {
if let ExprIndex(ref lhs1, ref idx1) = lhs1.node {
if let ExprIndex(ref lhs2, ref idx2) = lhs2.node {
if SpanlessEq::new(cx).ignore_fn().eq_expr(lhs1, lhs2) {
@@ -104,7 +108,10 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
if let Some(slice) = Sugg::hir_opt(cx, slice) {
(false,
format!(" elements of `{}`", slice),
- format!("{}.swap({}, {})", slice.maybe_par(), snippet(cx, idx1.span, ".."), snippet(cx, idx2.span, "..")))
+ format!("{}.swap({}, {})",
+ slice.maybe_par(),
+ snippet(cx, idx1.span, ".."),
+ snippet(cx, idx2.span, "..")))
} else {
(false, "".to_owned(), "".to_owned())
}
@@ -148,7 +155,9 @@ fn check_suspicious_swap(cx: &LateContext, block: &Block) {
SpanlessEq::new(cx).ignore_fn().eq_expr(lhs0, rhs1),
SpanlessEq::new(cx).ignore_fn().eq_expr(lhs1, rhs0)
], {
- let (what, lhs, rhs) = if let (Some(first), Some(second)) = (Sugg::hir_opt(cx, lhs0), Sugg::hir_opt(cx, rhs0)) {
+ let lhs0 = Sugg::hir_opt(cx, lhs0);
+ let rhs0 = Sugg::hir_opt(cx, rhs0);
+ let (what, lhs, rhs) = if let (Some(first), Some(second)) = (lhs0, rhs0) {
(format!(" `{}` and `{}`", first, second), first.mut_addr().to_string(), second.mut_addr().to_string())
} else {
("".to_owned(), "".to_owned(), "".to_owned())
diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs
index 2f6e6d97fbf7..1669b2d65572 100644
--- a/clippy_lints/src/temporary_assignment.rs
+++ b/clippy_lints/src/temporary_assignment.rs
@@ -46,7 +46,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
if is_temporary(base) && !is_adjusted(cx, base) {
span_lint(cx, TEMPORARY_ASSIGNMENT, expr.span, "assignment to temporary");
}
- }
+ },
_ => (),
}
}
diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs
index b6731db93839..5e01f891eb17 100644
--- a/clippy_lints/src/transmute.rs
+++ b/clippy_lints/src/transmute.rs
@@ -95,18 +95,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
let to_ty = cx.tcx.tables().expr_ty(e);
match (&from_ty.sty, &to_ty.sty) {
- _ if from_ty == to_ty => span_lint(
- cx,
- USELESS_TRANSMUTE,
- e.span,
- &format!("transmute from a type (`{}`) to itself", from_ty),
- ),
- (&TyRef(_, rty), &TyRawPtr(ptr_ty)) => span_lint_and_then(
- cx,
- USELESS_TRANSMUTE,
- e.span,
- "transmute from a reference to a pointer",
- |db| {
+ _ if from_ty == to_ty => {
+ span_lint(cx,
+ USELESS_TRANSMUTE,
+ e.span,
+ &format!("transmute from a type (`{}`) to itself", from_ty))
+ },
+ (&TyRef(_, rty), &TyRawPtr(ptr_ty)) => {
+ span_lint_and_then(cx,
+ USELESS_TRANSMUTE,
+ e.span,
+ "transmute from a reference to a pointer",
+ |db| {
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
let sugg = if ptr_ty == rty {
arg.as_ty(to_ty)
@@ -116,53 +116,54 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
db.span_suggestion(e.span, "try", sugg.to_string());
}
- },
- ),
+ })
+ },
(&ty::TyInt(_), &TyRawPtr(_)) |
- (&ty::TyUint(_), &TyRawPtr(_)) => span_lint_and_then(
- cx,
- USELESS_TRANSMUTE,
- e.span,
- "transmute from an integer to a pointer",
- |db| {
+ (&ty::TyUint(_), &TyRawPtr(_)) => {
+ span_lint_and_then(cx,
+ USELESS_TRANSMUTE,
+ e.span,
+ "transmute from an integer to a pointer",
+ |db| {
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
db.span_suggestion(e.span, "try", arg.as_ty(&to_ty.to_string()).to_string());
}
- },
- ),
+ })
+ },
(&ty::TyFloat(_), &TyRef(..)) |
(&ty::TyFloat(_), &TyRawPtr(_)) |
(&ty::TyChar, &TyRef(..)) |
- (&ty::TyChar, &TyRawPtr(_)) => span_lint(
- cx,
- WRONG_TRANSMUTE,
- e.span,
- &format!("transmute from a `{}` to a pointer", from_ty),
- ),
- (&TyRawPtr(from_ptr), _) if from_ptr.ty == to_ty => span_lint(
- cx,
- CROSSPOINTER_TRANSMUTE,
- e.span,
- &format!("transmute from a type (`{}`) to the type that it points to (`{}`)",
- from_ty,
- to_ty),
- ),
- (_, &TyRawPtr(to_ptr)) if to_ptr.ty == from_ty => span_lint(
- cx,
- CROSSPOINTER_TRANSMUTE,
- e.span,
- &format!("transmute from a type (`{}`) to a pointer to that type (`{}`)",
- from_ty,
- to_ty),
- ),
- (&TyRawPtr(from_pty), &TyRef(_, to_rty)) => span_lint_and_then(
- cx,
- TRANSMUTE_PTR_TO_REF,
- e.span,
- &format!("transmute from a pointer type (`{}`) to a reference type (`{}`)",
- from_ty,
- to_ty),
- |db| {
+ (&ty::TyChar, &TyRawPtr(_)) => {
+ span_lint(cx,
+ WRONG_TRANSMUTE,
+ e.span,
+ &format!("transmute from a `{}` to a pointer", from_ty))
+ },
+ (&TyRawPtr(from_ptr), _) if from_ptr.ty == to_ty => {
+ span_lint(cx,
+ CROSSPOINTER_TRANSMUTE,
+ e.span,
+ &format!("transmute from a type (`{}`) to the type that it points to (`{}`)",
+ from_ty,
+ to_ty))
+ },
+ (_, &TyRawPtr(to_ptr)) if to_ptr.ty == from_ty => {
+ span_lint(cx,
+ CROSSPOINTER_TRANSMUTE,
+ e.span,
+ &format!("transmute from a type (`{}`) to a pointer to that type (`{}`)",
+ from_ty,
+ to_ty))
+ },
+ (&TyRawPtr(from_pty), &TyRef(_, to_rty)) => {
+ span_lint_and_then(cx,
+ TRANSMUTE_PTR_TO_REF,
+ e.span,
+ &format!("transmute from a pointer type (`{}`) to a reference type \
+ (`{}`)",
+ from_ty,
+ to_ty),
+ |db| {
let arg = sugg::Sugg::hir(cx, &args[0], "..");
let (deref, cast) = if to_rty.mutbl == Mutability::MutMutable {
("&mut *", "*mut")
@@ -177,8 +178,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute {
};
db.span_suggestion(e.span, "try", sugg::make_unop(deref, arg).to_string());
- },
- ),
+ })
+ },
_ => return,
};
}
diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index 930c44c88633..89bc46074fda 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -6,8 +6,8 @@ use rustc::ty;
use std::cmp::Ordering;
use syntax::ast::{IntTy, UintTy, FloatTy};
use syntax::codemap::Span;
-use utils::{comparisons, higher, in_external_macro, in_macro, match_def_path, snippet,
- span_help_and_lint, span_lint, opt_def_id, last_path_segment};
+use utils::{comparisons, higher, in_external_macro, in_macro, match_def_path, snippet, span_help_and_lint, span_lint,
+ opt_def_id, last_path_segment};
use utils::paths;
/// Handles all the linting of funky types
@@ -95,10 +95,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass {
}}
} else if match_def_path(cx, def_id, &paths::LINKED_LIST) {
span_help_and_lint(cx,
- LINKEDLIST,
- ast_ty.span,
- "I see you're using a LinkedList! Perhaps you meant some other data structure?",
- "a VecDeque might work");
+ LINKEDLIST,
+ ast_ty.span,
+ "I see you're using a LinkedList! Perhaps you meant some other data structure?",
+ "a VecDeque might work");
}
}
}
@@ -141,7 +141,7 @@ fn check_let_unit(cx: &LateContext, decl: &Decl) {
decl.span,
&format!("this let-binding has unit value. Consider omitting `let {} =`",
snippet(cx, local.pat.span, "..")));
- }
+ },
_ => (),
}
}
@@ -211,8 +211,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitCmp {
&format!("{}-comparison of unit values detected. This will always be {}",
op.as_str(),
result));
- }
- _ => ()
+ },
+ _ => (),
}
}
}
@@ -336,11 +336,7 @@ fn is_isize_or_usize(typ: &ty::TyS) -> bool {
}
fn span_precision_loss_lint(cx: &LateContext, expr: &Expr, cast_from: &ty::TyS, cast_to_f64: bool) {
- let mantissa_nbits = if cast_to_f64 {
- 52
- } else {
- 23
- };
+ let mantissa_nbits = if cast_to_f64 { 52 } else { 23 };
let arch_dependent = is_isize_or_usize(cast_from) && cast_to_f64;
let arch_dependent_str = "on targets with 64-bit wide pointers ";
let from_nbits_str = if arch_dependent {
@@ -356,11 +352,7 @@ fn span_precision_loss_lint(cx: &LateContext, expr: &Expr, cast_from: &ty::TyS,
&format!("casting {0} to {1} causes a loss of precision {2}({0} is {3} bits wide, but {1}'s mantissa \
is only {4} bits wide)",
cast_from,
- if cast_to_f64 {
- "f64"
- } else {
- "f32"
- },
+ if cast_to_f64 { "f64" } else { "f32" },
if arch_dependent {
arch_dependent_str
} else {
@@ -388,27 +380,27 @@ fn check_truncation_and_wrapping(cx: &LateContext, expr: &Expr, cast_from: &ty::
ArchSuffix::None,
to_nbits == from_nbits && cast_unsigned_to_signed,
ArchSuffix::None)
- }
+ },
(true, false) => {
(to_nbits <= 32,
if to_nbits == 32 {
- ArchSuffix::_64
- } else {
- ArchSuffix::None
- },
+ ArchSuffix::_64
+ } else {
+ ArchSuffix::None
+ },
to_nbits <= 32 && cast_unsigned_to_signed,
ArchSuffix::_32)
- }
+ },
(false, true) => {
(from_nbits == 64,
ArchSuffix::_32,
cast_unsigned_to_signed,
if from_nbits == 64 {
- ArchSuffix::_64
- } else {
- ArchSuffix::_32
- })
- }
+ ArchSuffix::_64
+ } else {
+ ArchSuffix::_32
+ })
+ },
};
if span_truncation {
span_lint(cx,
@@ -463,7 +455,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
if is_isize_or_usize(cast_from) || from_nbits >= to_nbits {
span_precision_loss_lint(cx, expr, cast_from, to_nbits == 64);
}
- }
+ },
(false, true) => {
span_lint(cx,
CAST_POSSIBLE_TRUNCATION,
@@ -475,7 +467,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
expr.span,
&format!("casting {} to {} may lose the sign of the value", cast_from, cast_to));
}
- }
+ },
(true, true) => {
if cast_from.is_signed() && !cast_to.is_signed() {
span_lint(cx,
@@ -484,16 +476,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
&format!("casting {} to {} may lose the sign of the value", cast_from, cast_to));
}
check_truncation_and_wrapping(cx, expr, cast_from, cast_to);
- }
+ },
(false, false) => {
- if let (&ty::TyFloat(FloatTy::F64), &ty::TyFloat(FloatTy::F32)) = (&cast_from.sty,
- &cast_to.sty) {
+ if let (&ty::TyFloat(FloatTy::F64), &ty::TyFloat(FloatTy::F32)) =
+ (&cast_from.sty, &cast_to.sty) {
span_lint(cx,
CAST_POSSIBLE_TRUNCATION,
expr.span,
"casting f64 to f32 may truncate the value");
}
- }
+ },
}
}
}
@@ -536,7 +528,15 @@ impl LintPass for TypeComplexityPass {
}
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass {
- fn check_fn(&mut self, cx: &LateContext<'a, 'tcx>, _: FnKind<'tcx>, decl: &'tcx FnDecl, _: &'tcx Expr, _: Span, _: NodeId) {
+ fn check_fn(
+ &mut self,
+ cx: &LateContext<'a, 'tcx>,
+ _: FnKind<'tcx>,
+ decl: &'tcx FnDecl,
+ _: &'tcx Expr,
+ _: Span,
+ _: NodeId
+ ) {
self.check_fndecl(cx, decl);
}
@@ -629,10 +629,7 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for TypeComplexityVisitor<'a, 'tcx> {
TyInfer | TyPtr(..) | TyRptr(..) => (1, 0),
// the "normal" components of a type: named types, arrays/tuples
- TyPath(..) |
- TySlice(..) |
- TyTup(..) |
- TyArray(..) => (10 * self.nest, 1),
+ TyPath(..) | TySlice(..) | TyTup(..) | TyArray(..) => (10 * self.nest, 1),
// "Sum" of trait bounds
TyObjectSum(..) => (20 * self.nest, 0),
@@ -693,9 +690,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 {
let msg = "casting character literal to u8. `char`s \
are 4 bytes wide in rust, so casting to u8 \
truncates them";
- let help = format!("Consider using a byte literal \
- instead:\nb{}",
- snippet(cx, e.span, "'x'"));
+ let help = format!("Consider using a byte literal instead:\nb{}", snippet(cx, e.span, "'x'"));
span_help_and_lint(cx, CHAR_LIT_AS_U8, expr.span, msg, &help);
}
}
@@ -752,8 +747,12 @@ enum AbsurdComparisonResult {
-fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs: &'a Expr)
- -> Option<(ExtremeExpr<'a>, AbsurdComparisonResult)> {
+fn detect_absurd_comparison<'a>(
+ cx: &LateContext,
+ op: BinOp_,
+ lhs: &'a Expr,
+ rhs: &'a Expr
+) -> Option<(ExtremeExpr<'a>, AbsurdComparisonResult)> {
use types::ExtremeType::*;
use types::AbsurdComparisonResult::*;
use utils::comparisons::*;
@@ -775,7 +774,7 @@ fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs
(_, Some(r @ ExtremeExpr { which: Minimum, .. })) => (r, AlwaysFalse), // x < min
_ => return None,
}
- }
+ },
Rel::Le => {
match (lx, rx) {
(Some(l @ ExtremeExpr { which: Minimum, .. }), _) => (l, AlwaysTrue), // min <= x
@@ -784,7 +783,7 @@ fn detect_absurd_comparison<'a>(cx: &LateContext, op: BinOp_, lhs: &'a Expr, rhs
(_, Some(r @ ExtremeExpr { which: Maximum, .. })) => (r, AlwaysTrue), // x <= max
_ => return None,
}
- }
+ },
Rel::Ne | Rel::Eq => return None,
})
}
@@ -864,7 +863,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons {
instead",
snippet(cx, lhs.span, "lhs"),
snippet(cx, rhs.span, "rhs"))
- }
+ },
};
let help = format!("because {} is the {} value for this type, {}",
@@ -967,7 +966,7 @@ fn numeric_cast_precast_bounds<'a>(cx: &LateContext, expr: &'a Expr) -> Option<(
IntTy::I64 => (FullInt::S(i64::min_value() as i64), FullInt::S(i64::max_value() as i64)),
IntTy::Is => (FullInt::S(isize::min_value() as i64), FullInt::S(isize::max_value() as i64)),
})
- }
+ },
TyUint(uint_ty) => {
Some(match uint_ty {
UintTy::U8 => (FullInt::U(u8::min_value() as u64), FullInt::U(u8::max_value() as u64)),
@@ -976,7 +975,7 @@ fn numeric_cast_precast_bounds<'a>(cx: &LateContext, expr: &'a Expr) -> Option<(
UintTy::U64 => (FullInt::U(u64::min_value() as u64), FullInt::U(u64::max_value() as u64)),
UintTy::Us => (FullInt::U(usize::min_value() as u64), FullInt::U(usize::max_value() as u64)),
})
- }
+ },
_ => None,
}
} else {
@@ -1001,7 +1000,7 @@ fn node_as_const_fullint(cx: &LateContext, expr: &Expr) -> Option {
} else {
None
}
- }
+ },
Err(_) => None,
}
}
@@ -1019,8 +1018,15 @@ fn err_upcast_comparison(cx: &LateContext, span: &Span, expr: &Expr, always: boo
}
}
-fn upcast_comparison_bounds_err(cx: &LateContext, span: &Span, rel: comparisons::Rel,
- lhs_bounds: Option<(FullInt, FullInt)>, lhs: &Expr, rhs: &Expr, invert: bool) {
+fn upcast_comparison_bounds_err(
+ cx: &LateContext,
+ span: &Span,
+ rel: comparisons::Rel,
+ lhs_bounds: Option<(FullInt, FullInt)>,
+ lhs: &Expr,
+ rhs: &Expr,
+ invert: bool
+) {
use utils::comparisons::*;
if let Some((lb, ub)) = lhs_bounds {
@@ -1036,14 +1042,14 @@ fn upcast_comparison_bounds_err(cx: &LateContext, span: &Span, rel: comparisons:
} else {
ub < norm_rhs_val
}
- }
+ },
Rel::Le => {
if invert {
norm_rhs_val <= lb
} else {
ub <= norm_rhs_val
}
- }
+ },
Rel::Eq | Rel::Ne => unreachable!(),
} {
err_upcast_comparison(cx, span, lhs, true)
@@ -1054,14 +1060,14 @@ fn upcast_comparison_bounds_err(cx: &LateContext, span: &Span, rel: comparisons:
} else {
lb >= norm_rhs_val
}
- }
+ },
Rel::Le => {
if invert {
norm_rhs_val > ub
} else {
lb > norm_rhs_val
}
- }
+ },
Rel::Eq | Rel::Ne => unreachable!(),
} {
err_upcast_comparison(cx, span, lhs, false)
diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs
index 341848a868cd..07afc55ae7f1 100644
--- a/clippy_lints/src/unsafe_removed_from_name.rs
+++ b/clippy_lints/src/unsafe_removed_from_name.rs
@@ -38,15 +38,14 @@ impl EarlyLintPass for UnsafeNameRemoval {
if let ItemKind::Use(ref item_use) = item.node {
match item_use.node {
ViewPath_::ViewPathSimple(ref name, ref path) => {
- unsafe_to_safe_check(
- path.segments
- .last()
- .expect("use paths cannot be empty")
- .identifier,
- *name,
- cx, &item.span
- );
- }
+ unsafe_to_safe_check(path.segments
+ .last()
+ .expect("use paths cannot be empty")
+ .identifier,
+ *name,
+ cx,
+ &item.span);
+ },
ViewPath_::ViewPathList(_, ref path_list_items) => {
for path_list_item in path_list_items.iter() {
let plid = path_list_item.node;
@@ -54,8 +53,8 @@ impl EarlyLintPass for UnsafeNameRemoval {
unsafe_to_safe_check(plid.name, rename, cx, &item.span);
};
}
- }
- ViewPath_::ViewPathGlob(_) => {}
+ },
+ ViewPath_::ViewPathGlob(_) => {},
}
}
}
@@ -68,11 +67,7 @@ fn unsafe_to_safe_check(old_name: Ident, new_name: Ident, cx: &EarlyContext, spa
span_lint(cx,
UNSAFE_REMOVED_FROM_NAME,
*span,
- &format!(
- "removed \"unsafe\" from the name of `{}` in use as `{}`",
- old_str,
- new_str
- ));
+ &format!("removed \"unsafe\" from the name of `{}` in use as `{}`", old_str, new_str));
}
}
diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs
index 4f1e01af6e9f..9017fd6933e8 100644
--- a/clippy_lints/src/unused_label.rs
+++ b/clippy_lints/src/unused_label.rs
@@ -48,7 +48,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel {
decl: &'tcx hir::FnDecl,
body: &'tcx hir::Expr,
span: Span,
- fn_id: ast::NodeId,
+ fn_id: ast::NodeId
) {
if in_macro(cx, span) {
return;
@@ -72,11 +72,11 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
hir::ExprBreak(Some(label), _) |
hir::ExprAgain(Some(label)) => {
self.labels.remove(&label.name.as_str());
- }
+ },
hir::ExprLoop(_, Some(label), _) |
hir::ExprWhile(_, _, Some(label)) => {
self.labels.insert(label.node.as_str(), expr.span);
- }
+ },
_ => (),
}
diff --git a/clippy_lints/src/utils/comparisons.rs b/clippy_lints/src/utils/comparisons.rs
index a277226eb67c..f973c2afd27a 100644
--- a/clippy_lints/src/utils/comparisons.rs
+++ b/clippy_lints/src/utils/comparisons.rs
@@ -18,8 +18,7 @@ pub enum Rel {
}
/// Put the expression in the form `lhs < rhs`, `lhs <= rhs`, `lhs == rhs` or `lhs != rhs`.
-pub fn normalize_comparison<'a>(op: BinOp_, lhs: &'a Expr, rhs: &'a Expr)
- -> Option<(Rel, &'a Expr, &'a Expr)> {
+pub fn normalize_comparison<'a>(op: BinOp_, lhs: &'a Expr, rhs: &'a Expr) -> Option<(Rel, &'a Expr, &'a Expr)> {
match op {
BinOp_::BiLt => Some((Rel::Lt, lhs, rhs)),
BinOp_::BiLe => Some((Rel::Le, lhs, rhs)),
diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs
index 9a1753d511ce..d80fa17e29f7 100644
--- a/clippy_lints/src/utils/conf.rs
+++ b/clippy_lints/src/utils/conf.rs
@@ -8,21 +8,20 @@ use syntax::{ast, codemap};
use toml;
/// Get the configuration file from arguments.
-pub fn file_from_args(args: &[codemap::Spanned]) -> Result