Skip to content

Commit

Permalink
auto merge of rust-lang#11788 : salemtalha/rust/master, r=huonw
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jan 25, 2014
2 parents b0ef2d5 + 1b4623d commit caabbb8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libstd/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit caabbb8

Please sign in to comment.