Auto merge of #17950 - DarkDrek:downcast_to_is, r=jdm

Replace downcast with is

<!-- Please describe your changes on the following line: -->
I searched for all places where `if let Some(_) = self.downcast::` and replaced them with `::is`

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [X] These changes fix #17697 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because `if let Some(_) = self.downcast::<Text>()` should be equivalent to `if self.is::<Text>()`

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17950)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-02 21:01:12 -05:00 committed by GitHub
commit 92b2c47fef
2 changed files with 2 additions and 2 deletions

View file

@ -91,7 +91,7 @@ impl CharacterDataMethods for CharacterData {
// If this is a Text node, we might need to re-parse (say, if our parent // If this is a Text node, we might need to re-parse (say, if our parent
// is a <style> element.) We don't need to if this is a Comment or // is a <style> element.) We don't need to if this is a Comment or
// ProcessingInstruction. // ProcessingInstruction.
if let Some(_) = self.downcast::<Text>() { if self.is::<Text>() {
if let Some(parent_node) = node.GetParentNode() { if let Some(parent_node) = node.GetParentNode() {
let mutation = ChildrenMutation::ChangeText; let mutation = ChildrenMutation::ChangeText;
vtable_for(&parent_node).children_changed(&mutation); vtable_for(&parent_node).children_changed(&mutation);

View file

@ -392,7 +392,7 @@ pub fn handle_is_selected(documents: &Documents,
else if let Some(option_element) = node.downcast::<HTMLOptionElement>() { else if let Some(option_element) = node.downcast::<HTMLOptionElement>() {
Ok(option_element.Selected()) Ok(option_element.Selected())
} }
else if let Some(_) = node.downcast::<HTMLElement>() { else if node.is::<HTMLElement>() {
Ok(false) // regular elements are not selectable Ok(false) // regular elements are not selectable
} else { } else {
Err(()) Err(())