Implement ptr.is_aligned() in terms of .is_aligned_to()

This commit is contained in:
Maybe Waffle 2022-04-15 01:58:59 +04:00
parent a908eec438
commit 6c1ebff59e
2 changed files with 2 additions and 2 deletions

View File

@ -1301,7 +1301,7 @@ pub fn is_aligned(self) -> bool
where
T: Sized,
{
self.addr() % core::mem::align_of::<T>() == 0
self.is_aligned_to(core::mem::align_of::<T>())
}
/// Returns whether the pointer is aligned to `align`.

View File

@ -1570,7 +1570,7 @@ pub fn is_aligned(self) -> bool
where
T: Sized,
{
self.addr() % core::mem::align_of::<T>() == 0
self.is_aligned_to(core::mem::align_of::<T>())
}
/// Returns whether the pointer is aligned to `align`.