Merge pull request #414 from ILyoan/remove_copy_hubbub2

Remove unnecessary copying in hubbub parser part 2
This commit is contained in:
Jack Moffitt 2013-05-02 21:50:49 -07:00
commit 8e9c719f5f

View file

@ -274,14 +274,13 @@ pub fn parse_html(url: Url,
},
create_element: |tag: ~hubbub::Tag| {
debug!("create element");
// TODO: remove copying here by using struct pattern matching to
// move all ~strs at once (blocked on Rust #3845, #3846, #3847)
let node = build_element_from_tag(tag.name);
debug!("-- attach attrs");
do node.as_mut_element |element| {
for tag.attributes.each |attr| {
element.attrs.push(Attr::new(copy attr.name, copy attr.value));
let &hubbub::Attribute {name: name, value: value, _} = attr;
element.attrs.push(Attr::new(name, value));
}
}