mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Remove a bunch of _forever suffixes in Attr methods
They don't return &'static references anymore.
This commit is contained in:
parent
ba5bcec7e4
commit
02fb5a68e6
2 changed files with 14 additions and 14 deletions
|
@ -234,35 +234,35 @@ impl Attr {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
pub trait AttrHelpersForLayout<'dom> {
|
||||
unsafe fn value_forever(self) -> &'dom AttrValue;
|
||||
unsafe fn value(self) -> &'dom AttrValue;
|
||||
unsafe fn value_ref_forever(self) -> &'dom str;
|
||||
unsafe fn value_tokens_forever(self) -> Option<&'dom [Atom]>;
|
||||
unsafe fn local_name_atom_forever(self) -> LocalName;
|
||||
unsafe fn value_tokens(self) -> Option<&'dom [Atom]>;
|
||||
unsafe fn local_name_atom(self) -> LocalName;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl<'dom> AttrHelpersForLayout<'dom> for LayoutDom<'dom, Attr> {
|
||||
#[inline]
|
||||
unsafe fn value_forever(self) -> &'dom AttrValue {
|
||||
unsafe fn value(self) -> &'dom AttrValue {
|
||||
(*self.unsafe_get()).value.borrow_for_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn value_ref_forever(self) -> &'dom str {
|
||||
&**self.value_forever()
|
||||
&**self.value()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn value_tokens_forever(self) -> Option<&'dom [Atom]> {
|
||||
unsafe fn value_tokens(self) -> Option<&'dom [Atom]> {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
match *self.value_forever() {
|
||||
match *self.value() {
|
||||
AttrValue::TokenList(_, ref tokens) => Some(tokens),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn local_name_atom_forever(self) -> LocalName {
|
||||
unsafe fn local_name_atom(self) -> LocalName {
|
||||
(*self.unsafe_get()).identifier.local_name.clone()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue