mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
style: Use the ? operator for Option
This commit is contained in:
parent
c52d347022
commit
3005a26daf
13 changed files with 47 additions and 129 deletions
|
@ -153,10 +153,7 @@ where
|
|||
K: Borrow<Q>,
|
||||
Q: PrecomputedHash + Hash + Eq,
|
||||
{
|
||||
let index = match self.index.iter().position(|k| k.borrow() == key) {
|
||||
Some(p) => p,
|
||||
None => return None,
|
||||
};
|
||||
let index = self.index.iter().position(|k| k.borrow() == key)?;
|
||||
self.index.remove(index);
|
||||
self.values.remove(key)
|
||||
}
|
||||
|
@ -194,10 +191,7 @@ where
|
|||
type Item = (&'a K, &'a V);
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
let key = match self.inner.index.get(self.pos) {
|
||||
Some(k) => k,
|
||||
None => return None,
|
||||
};
|
||||
let key = self.inner.index.get(self.pos)?;
|
||||
|
||||
self.pos += 1;
|
||||
let value = &self.inner.values[key];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue