Make LayoutCharacterDataHelpers::data_for_layout be safe

This commit is contained in:
Anthony Ramine 2020-03-31 14:40:47 +02:00
parent 00c5ec202c
commit 409bd3d989
4 changed files with 7 additions and 9 deletions

View file

@ -280,16 +280,15 @@ impl CharacterDataMethods for CharacterData {
}
}
#[allow(unsafe_code)]
pub trait LayoutCharacterDataHelpers<'dom> {
unsafe fn data_for_layout(self) -> &'dom str;
fn data_for_layout(self) -> &'dom str;
}
#[allow(unsafe_code)]
impl<'dom> LayoutCharacterDataHelpers<'dom> for LayoutDom<'dom, CharacterData> {
#[allow(unsafe_code)]
#[inline]
unsafe fn data_for_layout(self) -> &'dom str {
&(*self.unsafe_get()).data.borrow_for_layout()
fn data_for_layout(self) -> &'dom str {
unsafe { self.unsafe_get().data.borrow_for_layout() }
}
}