mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Use match ergonomics for artithmetic lint
This commit is contained in:
@@ -73,8 +73,8 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
match expr.node {
|
||||
hir::ExprKind::Binary(ref op, ref l, ref r) => {
|
||||
match &expr.node {
|
||||
hir::ExprKind::Binary(op, l, r) => {
|
||||
match op.node {
|
||||
hir::BinOpKind::And
|
||||
| hir::BinOpKind::Or
|
||||
@@ -100,7 +100,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
|
||||
self.expr_span = Some(expr.span);
|
||||
}
|
||||
},
|
||||
hir::ExprKind::Unary(hir::UnOp::UnNeg, ref arg) => {
|
||||
hir::ExprKind::Unary(hir::UnOp::UnNeg, arg) => {
|
||||
let ty = cx.tables.expr_ty(arg);
|
||||
if ty.is_integral() {
|
||||
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
|
||||
|
||||
Reference in New Issue
Block a user