use rustc_middle::mir::{Operand, Place};
pub trait OperandExt<'tcx> {
fn as_place(&self) -> Option<Place<'tcx>>;
}
impl<'tcx> OperandExt<'tcx> for Operand<'tcx> {
fn as_place(&self) -> Option<Place<'tcx>> {
match self {
Operand::Copy(place) | Operand::Move(place) => Some(*place),
Operand::Constant(_) | Operand::RuntimeChecks(_) => None,
}
}
}