improve speed of to_string for Classes (#772)

This commit is contained in:
Henry Zimmerman 2019-12-04 16:00:37 -05:00 committed by Justin Starry
parent fd8c3ee665
commit 45574e53ae

View File

@ -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(" ")
}
}