mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Remove unnecessary copying in hubbub parser
This commit is contained in:
parent
70b39cceec
commit
4452d1943b
1 changed files with 6 additions and 12 deletions
|
@ -260,20 +260,14 @@ pub fn parse_html(url: Url,
|
||||||
},
|
},
|
||||||
create_doctype: |doctype: ~hubbub::Doctype| {
|
create_doctype: |doctype: ~hubbub::Doctype| {
|
||||||
debug!("create doctype");
|
debug!("create doctype");
|
||||||
// TODO: remove copying here by using struct pattern matching to
|
let ~hubbub::Doctype {name: name,
|
||||||
// move all ~strs at once (blocked on Rust #3845, #3846, #3847)
|
public_id: public_id,
|
||||||
let public_id = match &doctype.public_id {
|
system_id: system_id,
|
||||||
&None => None,
|
force_quirks: force_quirks } = doctype;
|
||||||
&Some(ref id) => Some(copy *id)
|
let node = ~Doctype::new(name,
|
||||||
};
|
|
||||||
let system_id = match &doctype.system_id {
|
|
||||||
&None => None,
|
|
||||||
&Some(ref id) => Some(copy *id)
|
|
||||||
};
|
|
||||||
let node = ~Doctype::new(copy doctype.name,
|
|
||||||
public_id,
|
public_id,
|
||||||
system_id,
|
system_id,
|
||||||
doctype.force_quirks);
|
force_quirks);
|
||||||
unsafe {
|
unsafe {
|
||||||
Node::as_abstract_node(node).to_hubbub_node()
|
Node::as_abstract_node(node).to_hubbub_node()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue