Skip to content

Commit

Permalink
Join Atoms without requiring intermediate Vec
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Jul 5, 2015
1 parent 2e1c978 commit 370520e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/script/dom/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ impl AttrValue {
}

pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue {
let tokens = atoms.iter().map(|x| &**x).collect::<Vec<_>>().connect("\x20");
let tokens = atoms.iter().fold(String::new(), |mut s, atom| {
s.push('\x20');
s.push_str(atom);
s
});
AttrValue::TokenList(tokens, atoms)
}

Expand Down

0 comments on commit 370520e

Please sign in to comment.