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:
Anthony Ramine 2016-08-29 00:55:29 +02:00
parent 6e1523f4ae
commit 7dfb336be8
22 changed files with 72 additions and 109 deletions

View file

@ -42,9 +42,7 @@ impl TouchListMethods for TouchList {
}
/// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index
fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Root<Touch>> {
let item = self.Item(index);
*found = item.is_some();
item
fn IndexedGetter(&self, index: u32) -> Option<Root<Touch>> {
self.Item(index)
}
}