aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltitleelement.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-07 14:55:02 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-10-21 11:40:34 +0200
commit68014af78e8e3f5de4df0f6cc4d63b99c77478f5 (patch)
treef65b1a66ad8d7ce65042e37cf654da75e1766939 /components/script/dom/htmltitleelement.rs
parent13ea3ac413c511872784ccde416956217746553c (diff)
downloadservo-68014af78e8e3f5de4df0f6cc4d63b99c77478f5.tar.gz
servo-68014af78e8e3f5de4df0f6cc4d63b99c77478f5.zip
Clean up the cast calls
Diffstat (limited to 'components/script/dom/htmltitleelement.rs')
-rw-r--r--components/script/dom/htmltitleelement.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs
index 8a5f90ff14e..cb22a7bd9c2 100644
--- a/components/script/dom/htmltitleelement.rs
+++ b/components/script/dom/htmltitleelement.rs
@@ -39,13 +39,10 @@ impl HTMLTitleElement {
impl HTMLTitleElementMethods for HTMLTitleElement {
// https://html.spec.whatwg.org/multipage/#dom-title-text
fn Text(&self) -> DOMString {
- let node = self.upcast::<Node>();
let mut content = String::new();
- for child in node.children() {
- let text: Option<&Text> = child.downcast::<Text>();
- match text {
- Some(text) => content.push_str(&text.upcast::<CharacterData>().data()),
- None => (),
+ for child in self.upcast::<Node>().children() {
+ if let Some(text) = child.downcast::<Text>() {
+ content.push_str(&text.upcast::<CharacterData>().data());
}
}
content
@@ -53,15 +50,13 @@ impl HTMLTitleElementMethods for HTMLTitleElement {
// https://html.spec.whatwg.org/multipage/#dom-title-text
fn SetText(&self, value: DOMString) {
- let node = self.upcast::<Node>();
- node.SetTextContent(Some(value))
+ self.upcast::<Node>().SetTextContent(Some(value))
}
}
impl VirtualMethods for HTMLTitleElement {
fn super_type(&self) -> Option<&VirtualMethods> {
- let htmlelement: &HTMLElement = self.upcast::<HTMLElement>();
- Some(htmlelement as &VirtualMethods)
+ Some(self.upcast::<HTMLElement>() as &VirtualMethods)
}
fn children_changed(&self, mutation: &ChildrenMutation) {