mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 06:47:34 +00:00
Fixed iter's is_empty to use is_none() and added relevant test flag
This commit is contained in:
parent
de57a22b9a
commit
1b4623d1dd
@ -1366,7 +1366,7 @@ impl<'a, A, T: Iterator<A>> Peekable<A, T> {
|
||||
/// Check whether peekable iterator is empty or not.
|
||||
#[inline]
|
||||
pub fn is_empty(&mut self) -> bool {
|
||||
self.peek().is_some()
|
||||
self.peek().is_none()
|
||||
}
|
||||
}
|
||||
|
||||
@ -2936,6 +2936,7 @@ mod tests {
|
||||
assert_eq!(ys, [5, 4, 3, 2, 1]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_peekable_is_empty() {
|
||||
let a = [1];
|
||||
let mut it = a.iter().peekable();
|
||||
|
Loading…
Reference in New Issue
Block a user