From 4452d1943b9548bf81b993e68c238cedd945d8e2 Mon Sep 17 00:00:00 2001 From: ILyoan Date: Fri, 3 May 2013 11:46:28 +0900 Subject: [PATCH] Remove unnecessary copying in hubbub parser --- src/servo/html/hubbub_html_parser.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/servo/html/hubbub_html_parser.rs b/src/servo/html/hubbub_html_parser.rs index ab9d6c789f8..70bfda06f1f 100644 --- a/src/servo/html/hubbub_html_parser.rs +++ b/src/servo/html/hubbub_html_parser.rs @@ -260,20 +260,14 @@ pub fn parse_html(url: Url, }, create_doctype: |doctype: ~hubbub::Doctype| { debug!("create doctype"); - // TODO: remove copying here by using struct pattern matching to - // move all ~strs at once (blocked on Rust #3845, #3846, #3847) - let public_id = match &doctype.public_id { - &None => None, - &Some(ref id) => Some(copy *id) - }; - let system_id = match &doctype.system_id { - &None => None, - &Some(ref id) => Some(copy *id) - }; - let node = ~Doctype::new(copy doctype.name, + let ~hubbub::Doctype {name: name, + public_id: public_id, + system_id: system_id, + force_quirks: force_quirks } = doctype; + let node = ~Doctype::new(name, public_id, system_id, - doctype.force_quirks); + force_quirks); unsafe { Node::as_abstract_node(node).to_hubbub_node() }