mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use Option<T> to return from getters
This removes the cumbersome &mut bool argument and offers overall a more readable code.
This commit is contained in:
parent
6e1523f4ae
commit
7dfb336be8
22 changed files with 72 additions and 109 deletions
|
@ -85,17 +85,13 @@ impl NamedNodeMapMethods for NamedNodeMap {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-namednodemap-item
|
||||
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Root<Attr>> {
|
||||
let item = self.Item(index);
|
||||
*found = item.is_some();
|
||||
item
|
||||
fn IndexedGetter(&self, index: u32) -> Option<Root<Attr>> {
|
||||
self.Item(index)
|
||||
}
|
||||
|
||||
// check-tidy: no specs after this line
|
||||
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> Option<Root<Attr>> {
|
||||
let item = self.GetNamedItem(name);
|
||||
*found = item.is_some();
|
||||
item
|
||||
fn NamedGetter(&self, name: DOMString) -> Option<Root<Attr>> {
|
||||
self.GetNamedItem(name)
|
||||
}
|
||||
|
||||
// https://heycam.github.io/webidl/#dfn-supported-property-names
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue