script: Simplify Node::collect_text_contents.

This commit is contained in:
Emilio Cobos Álvarez 2016-12-25 17:30:29 +01:00
parent 157ce33105
commit 2bbde04ccd
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -1792,9 +1792,8 @@ impl Node {
pub fn collect_text_contents<T: Iterator<Item=Root<Node>>>(iterator: T) -> DOMString {
let mut content = String::new();
for node in iterator {
match node.downcast::<Text>() {
Some(ref text) => content.push_str(&text.upcast::<CharacterData>().data()),
None => (),
if let Some(ref text) = node.downcast::<Text>() {
content.push_str(&text.upcast::<CharacterData>().data());
}
}
DOMString::from(content)