1
Fork 0

also run rustfmt on clippy-lints

This commit is contained in:
Oliver Schneider 2016-12-20 18:21:30 +01:00
parent 4d0864b277
commit 4a4e1ea2c5
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46
72 changed files with 1017 additions and 1204 deletions

View file

@ -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, "_")));
});
}
}
}