Rollup merge of #37565 - mglagla:peek_use_as_ref, r=alexcrichton

Peekable::peek(): Use Option::as_ref()

Replace the match expression in .peek() with Option::as_ref() since it's the same functionality.
This commit is contained in:
Alex Crichton 2016-11-04 16:49:31 -07:00
commit b9f18bf79b

View File

@ -1374,10 +1374,7 @@ impl<I: Iterator> Peekable<I> {
if self.peeked.is_none() {
self.peeked = self.iter.next();
}
match self.peeked {
Some(ref value) => Some(value),
None => None,
}
self.peeked.as_ref()
}
}