Skip to content

Commit 8b9287d

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#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.
2 parents 0c85ad8 + ed0230e commit 8b9287d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/libcore/iter/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1374,10 +1374,7 @@ impl<I: Iterator> Peekable<I> {
13741374
if self.peeked.is_none() {
13751375
self.peeked = self.iter.next();
13761376
}
1377-
match self.peeked {
1378-
Some(ref value) => Some(value),
1379-
None => None,
1380-
}
1377+
self.peeked.as_ref()
13811378
}
13821379
}
13831380

0 commit comments

Comments
 (0)