diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-08-29 00:55:29 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-08-30 19:07:19 +0200 |
commit | 7dfb336be8dae1e2be9b898c374b6715e2a00ac7 (patch) | |
tree | 775fbf5f78d812db39ddfab79c56731262d5aded /components/script/dom/htmlformcontrolscollection.rs | |
parent | 6e1523f4ae61c16578a462c2e5335cbc95a6ef04 (diff) | |
download | servo-7dfb336be8dae1e2be9b898c374b6715e2a00ac7.tar.gz servo-7dfb336be8dae1e2be9b898c374b6715e2a00ac7.zip |
Use Option<T> to return from getters
This removes the cumbersome &mut bool argument and offers overall
a more readable code.
Diffstat (limited to 'components/script/dom/htmlformcontrolscollection.rs')
-rw-r--r-- | components/script/dom/htmlformcontrolscollection.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index 9229b854b26..e52a541225f 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -77,10 +77,8 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { } // https://html.spec.whatwg.org/multipage/#dom-htmlformcontrolscollection-nameditem - fn NamedGetter(&self, name: DOMString, found: &mut bool) -> Option<RadioNodeListOrElement> { - let maybe_elem = self.NamedItem(name); - *found = maybe_elem.is_some(); - maybe_elem + fn NamedGetter(&self, name: DOMString) -> Option<RadioNodeListOrElement> { + self.NamedItem(name) } // https://html.spec.whatwg.org/multipage/#the-htmlformcontrolscollection-interface:supported-property-names @@ -93,7 +91,7 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { // https://github.com/servo/servo/issues/5875 // // https://dom.spec.whatwg.org/#dom-htmlcollection-item - fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Root<Element>> { - self.collection.IndexedGetter(index, found) + fn IndexedGetter(&self, index: u32) -> Option<Root<Element>> { + self.collection.IndexedGetter(index) } } |