Skip to content

Commit

Permalink
improve speed of to_string for Classes (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
hgzimmerman authored and jstarry committed Dec 4, 2019
1 parent fd8c3ee commit 45574e5
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 45574e5

Please sign in to comment.