1
Fork 0

libstd: Prefer Option::map/etc over match where applicable

This commit is contained in:
Colin Wallace 2018-07-23 22:00:51 -07:00
parent 8dbbd81f7e
commit 4f3ab4986e
3 changed files with 6 additions and 13 deletions

View file

@ -1065,10 +1065,7 @@ impl<'a> Iterator for Ancestors<'a> {
fn next(&mut self) -> Option<Self::Item> {
let next = self.next;
self.next = match next {
Some(path) => path.parent(),
None => None,
};
self.next = next.and_then(Path::parent);
next
}
}