1
Fork 0

simplify more, ret_deref -> has_deref

This commit is contained in:
ouz-a 2022-05-16 16:23:42 +03:00
parent c0e4230bf5
commit c3e1e7a947
3 changed files with 9 additions and 11 deletions

View file

@ -1463,11 +1463,11 @@ impl<'tcx> Place<'tcx> {
/// If MirPhase >= Derefered and if projection contains Deref,
/// It's guaranteed to be in the first place
pub fn ret_deref(&self) -> Option<PlaceElem<'tcx>> {
pub fn has_deref(&self) -> bool {
if !self.projection.is_empty() && self.projection[0] == PlaceElem::Deref {
return Some(self.projection[0]);
true
} else {
None
false
}
}
@ -1545,11 +1545,11 @@ impl<'tcx> PlaceRef<'tcx> {
/// If MirPhase >= Derefered and if projection contains Deref,
/// It's guaranteed to be in the first place
pub fn ret_deref(&self) -> Option<PlaceElem<'tcx>> {
pub fn has_deref(&self) -> bool {
if !self.projection.is_empty() && self.projection[0] == PlaceElem::Deref {
return Some(self.projection[0]);
true
} else {
None
false
}
}