Skip to content

Commit

Permalink
improve speed of to_string for Classes (yewstack#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgzimmerman authored and llebout committed Jan 20, 2020
1 parent 59bfd70 commit 7055c18
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/virtual_dom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ impl Classes {

impl ToString for Classes {
fn to_string(&self) -> String {
let mut buf = String::new();
for class in &self.set {
buf.push_str(class);
buf.push(' ');
}
buf.pop();
buf
self.set
.iter()
.map(String::as_str)
.collect::<Vec<&str>>()
.join(" ")
}
}

Expand Down

0 comments on commit 7055c18

Please sign in to comment.