Fix clippy
This commit is contained in:
parent
4f589e322d
commit
0cd64b5756
@ -149,7 +149,7 @@ fn visit_region(&mut self, _: ty::Region<'_>) -> Self::Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
|
fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
|
||||||
use rustc_middle::mir::Rvalue::{Aggregate, BinaryOp, Cast, CheckedBinaryOp, Repeat, UnaryOp, Use};
|
use rustc_middle::mir::Rvalue::{Aggregate, BinaryOp, Cast, Repeat, UnaryOp, Use};
|
||||||
|
|
||||||
let mut visit_op = |op: &mir::Operand<'_>| match op {
|
let mut visit_op = |op: &mir::Operand<'_>| match op {
|
||||||
mir::Operand::Copy(p) | mir::Operand::Move(p) => visit(p.local),
|
mir::Operand::Copy(p) | mir::Operand::Move(p) => visit(p.local),
|
||||||
@ -159,7 +159,7 @@ fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) {
|
|||||||
match rvalue {
|
match rvalue {
|
||||||
Use(op) | Repeat(op, _) | Cast(_, op, _) | UnaryOp(_, op) => visit_op(op),
|
Use(op) | Repeat(op, _) | Cast(_, op, _) | UnaryOp(_, op) => visit_op(op),
|
||||||
Aggregate(_, ops) => ops.iter().for_each(visit_op),
|
Aggregate(_, ops) => ops.iter().for_each(visit_op),
|
||||||
BinaryOp(_, box (lhs, rhs)) | CheckedBinaryOp(_, box (lhs, rhs)) => {
|
BinaryOp(_, box (lhs, rhs)) => {
|
||||||
visit_op(lhs);
|
visit_op(lhs);
|
||||||
visit_op(rhs);
|
visit_op(rhs);
|
||||||
},
|
},
|
||||||
|
@ -161,7 +161,7 @@ fn check_rvalue<'tcx>(
|
|||||||
"transmute can attempt to turn pointers into integers, so is unstable in const fn".into(),
|
"transmute can attempt to turn pointers into integers, so is unstable in const fn".into(),
|
||||||
)),
|
)),
|
||||||
// binops are fine on integers
|
// binops are fine on integers
|
||||||
Rvalue::BinaryOp(_, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(_, box (lhs, rhs)) => {
|
Rvalue::BinaryOp(_, box (lhs, rhs)) => {
|
||||||
check_operand(tcx, lhs, span, body)?;
|
check_operand(tcx, lhs, span, body)?;
|
||||||
check_operand(tcx, rhs, span, body)?;
|
check_operand(tcx, rhs, span, body)?;
|
||||||
let ty = lhs.ty(body, tcx);
|
let ty = lhs.ty(body, tcx);
|
||||||
|
Loading…
Reference in New Issue
Block a user