diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-06-25 23:41:36 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-07-03 00:04:48 +0300 |
| commit | 30c046ede47ea45a772d2656b0365a4807263bca (patch) | |
| tree | c1b13657170546b91e8845a957ef9e80b6a5de71 /clippy_lints/src/modulo_arithmetic.rs | |
| parent | 590e07bbc2d2cba6377476c6b8442400327ff579 (diff) | |
Use 'tcx for references to AccessLevels wherever possible.
Diffstat (limited to 'clippy_lints/src/modulo_arithmetic.rs')
| -rw-r--r-- | clippy_lints/src/modulo_arithmetic.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clippy_lints/src/modulo_arithmetic.rs b/clippy_lints/src/modulo_arithmetic.rs index f76e4721e1f..59ccc6333fd 100644 --- a/clippy_lints/src/modulo_arithmetic.rs +++ b/clippy_lints/src/modulo_arithmetic.rs @@ -36,7 +36,7 @@ struct OperandInfo { is_integral: bool, } -fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> Option<OperandInfo> { +fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<OperandInfo> { match constant(cx, cx.tables(), operand) { Some((Constant::Int(v), _)) => match cx.tables().expr_ty(expr).kind { ty::Int(ity) => { @@ -79,8 +79,8 @@ fn might_have_negative_value(t: &ty::TyS<'_>) -> bool { t.is_signed() || t.is_floating_point() } -fn check_const_operands<'a, 'tcx>( - cx: &LateContext<'a, 'tcx>, +fn check_const_operands<'tcx>( + cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, lhs_operand: &OperandInfo, rhs_operand: &OperandInfo, @@ -105,7 +105,7 @@ fn check_const_operands<'a, 'tcx>( } } -fn check_non_const_operands<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>, operand: &Expr<'_>) { +fn check_non_const_operands<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, operand: &Expr<'_>) { let operand_type = cx.tables().expr_ty(operand); if might_have_negative_value(operand_type) { span_lint_and_then( @@ -123,8 +123,8 @@ fn check_non_const_operands<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Ex } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ModuloArithmetic { - fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) { +impl<'tcx> LateLintPass<'tcx> for ModuloArithmetic { + fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { match &expr.kind { ExprKind::Binary(op, lhs, rhs) | ExprKind::AssignOp(op, lhs, rhs) => { if let BinOpKind::Rem = op.node { |
