aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmloptionelement.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2015-09-28 19:57:06 -0400
committerCorey Farwell <coreyf@rwell.org>2015-09-28 19:57:06 -0400
commitf14f09e8868d0cad0308c2fa8eec8369560ee096 (patch)
treeab39cbd3e2c4a7b8b40344d2210f20398759fc80 /components/script/dom/htmloptionelement.rs
parent2857e547be606cbed1e5db060d254116223b7723 (diff)
downloadservo-f14f09e8868d0cad0308c2fa8eec8369560ee096.tar.gz
servo-f14f09e8868d0cad0308c2fa8eec8369560ee096.zip
Use util::str::str_join in more places
Instead of intermediate allocations of `Vec`s, we should utilize `str_join` which operates on iterators
Diffstat (limited to 'components/script/dom/htmloptionelement.rs')
-rw-r--r--components/script/dom/htmloptionelement.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index 79f710db1d2..432d6dc2bee 100644
--- a/components/script/dom/htmloptionelement.rs
+++ b/components/script/dom/htmloptionelement.rs
@@ -18,7 +18,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::node::{Node, NodeTypeId};
use dom::virtualmethods::VirtualMethods;
use std::cell::Cell;
-use util::str::{DOMString, split_html_space_chars};
+use util::str::{DOMString, split_html_space_chars, str_join};
#[dom_struct]
pub struct HTMLOptionElement {
@@ -93,8 +93,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
let node = NodeCast::from_ref(self);
let mut content = String::new();
collect_text(&node, &mut content);
- let v: Vec<&str> = split_html_space_chars(&content).collect();
- v.join(" ")
+ str_join(split_html_space_chars(&content), " ")
}
// https://www.whatwg.org/html/#dom-option-text