mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Don't clone the result of AttrHelpersForLayout::local_name
There is no need to do that. Embrace returning borrows from the DOM, it good.
This commit is contained in:
parent
4db84bede8
commit
47c9f19121
2 changed files with 5 additions and 5 deletions
|
@ -237,7 +237,7 @@ pub trait AttrHelpersForLayout<'dom> {
|
|||
fn value(self) -> &'dom AttrValue;
|
||||
fn as_str(self) -> &'dom str;
|
||||
fn as_tokens(self) -> Option<&'dom [Atom]>;
|
||||
fn local_name(self) -> LocalName;
|
||||
fn local_name(self) -> &'dom LocalName;
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -262,7 +262,7 @@ impl<'dom> AttrHelpersForLayout<'dom> for LayoutDom<'dom, Attr> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn local_name(self) -> LocalName {
|
||||
unsafe { self.unsafe_get().identifier.local_name.clone() }
|
||||
fn local_name(self) -> &'dom LocalName {
|
||||
unsafe { &self.unsafe_get().identifier.local_name }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -578,7 +578,7 @@ pub unsafe fn get_attr_for_layout<'dom>(
|
|||
.iter()
|
||||
.find(|attr| {
|
||||
let attr = attr.to_layout();
|
||||
*name == attr.local_name() && (*attr.unsafe_get()).namespace() == namespace
|
||||
name == attr.local_name() && (*attr.unsafe_get()).namespace() == namespace
|
||||
})
|
||||
.map(|attr| attr.to_layout())
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ impl RawLayoutElementHelpers for Element {
|
|||
.iter()
|
||||
.filter_map(|attr| {
|
||||
let attr = attr.to_layout();
|
||||
if *name == attr.local_name() {
|
||||
if name == attr.local_name() {
|
||||
Some(attr.value())
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue