mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Auto merge of #19537 - mbrubeck:try, r=nox
style: Use the ? operator for Option This is stable in Rust 1.22 (#19532). --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because it is refactoring only <!-- 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/19537) <!-- Reviewable:end -->
This commit is contained in:
commit
5f4f355cea
13 changed files with 47 additions and 129 deletions
|
@ -89,10 +89,7 @@ impl Iterator for OriginSetIterator {
|
|||
|
||||
fn next(&mut self) -> Option<Origin> {
|
||||
loop {
|
||||
let origin = match Origin::from_index(self.cur) {
|
||||
Some(origin) => origin,
|
||||
None => return None,
|
||||
};
|
||||
let origin = Origin::from_index(self.cur)?;
|
||||
|
||||
self.cur += 1;
|
||||
|
||||
|
@ -184,10 +181,7 @@ impl<'a, T> Iterator for PerOriginIter<'a, T> where T: 'a {
|
|||
type Item = (&'a T, Origin);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let origin = match Origin::from_index(self.cur) {
|
||||
Some(origin) => origin,
|
||||
None => return None,
|
||||
};
|
||||
let origin = Origin::from_index(self.cur)?;
|
||||
|
||||
self.cur += if self.rev { -1 } else { 1 };
|
||||
|
||||
|
@ -211,10 +205,7 @@ impl<'a, T> Iterator for PerOriginIterMut<'a, T> where T: 'a {
|
|||
type Item = (&'a mut T, Origin);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let origin = match Origin::from_index(self.cur) {
|
||||
Some(origin) => origin,
|
||||
None => return None,
|
||||
};
|
||||
let origin = Origin::from_index(self.cur)?;
|
||||
|
||||
self.cur += 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue