1
Fork 0
This commit is contained in:
Oliver Schneider 2017-08-09 09:30:56 +02:00
parent 705c6ec2a4
commit b25b6b3355
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
95 changed files with 3090 additions and 2022 deletions

View file

@ -40,12 +40,14 @@ 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_sugg(cx,
DEREF_ADDROF,
e.span,
"immediately dereferencing a reference",
"try this",
format!("{}", snippet(cx, addrof_target.span, "_")));
span_lint_and_sugg(
cx,
DEREF_ADDROF,
e.span,
"immediately dereferencing a reference",
"try this",
format!("{}", snippet(cx, addrof_target.span, "_")),
);
}
}
}