Skip to content

Commit

Permalink
Fixed iter's is_empty to use is_none() and added relevant test flag
Browse files Browse the repository at this point in the history
  • Loading branch information
salemtalha committed Jan 25, 2014
1 parent de57a22 commit 1b4623d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libstd/iter.rs
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

5 comments on commit 1b4623d

@bors
Copy link
Contributor

@bors bors commented on 1b4623d Jan 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at salemtalha@1b4623d

@bors
Copy link
Contributor

@bors bors commented on 1b4623d Jan 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging salemtalha/rust/master = 1b4623d into auto

@bors
Copy link
Contributor

@bors bors commented on 1b4623d Jan 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

salemtalha/rust/master = 1b4623d merged ok, testing candidate = caabbb8

@bors
Copy link
Contributor

@bors bors commented on 1b4623d Jan 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 1b4623d Jan 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = caabbb8

Please sign in to comment.