corrections on safety comments

This commit is contained in:
TyPR124 2020-03-16 16:18:35 -04:00
parent cce8ee8bf7
commit 16712ede62

View File

@ -79,14 +79,14 @@ impl Buf {
pub fn as_slice(&self) -> &Slice {
// Safety: Slice is just a wrapper for Wtf8,
// and as_slice returns &Wtf8. Therefore,
// transmute &Wtf8 to &Slice is safe.
// transmuting &Wtf8 to &Slice is safe.
unsafe { mem::transmute(self.inner.as_slice()) }
}
pub fn as_mut_slice(&mut self) -> &mut Slice {
// Safety: Slice is just a wrapper for Wtf8,
// and as_slice returns &Wtf8. Therefore,
// transmute &mut Wtf8 to &mut Slice is safe.
// and as_mut_slice returns &mut Wtf8. Therefore,
// transmuting &mut Wtf8 to &mut Slice is safe.
unsafe { mem::transmute(self.inner.as_mut_slice()) }
}