mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
renamed empty() to is_empty()
This commit is contained in:
parent
901dc2c15e
commit
4993c7c804
@ -1365,7 +1365,7 @@ impl<'a, A, T: Iterator<A>> Peekable<A, T> {
|
||||
|
||||
/// Check whether peekable iterator is empty or not.
|
||||
#[inline]
|
||||
pub fn empty(&mut self) -> bool {
|
||||
pub fn is_empty(&mut self) -> bool {
|
||||
self.peek().is_some()
|
||||
}
|
||||
}
|
||||
@ -2930,11 +2930,11 @@ mod tests {
|
||||
assert_eq!(ys, [5, 4, 3, 2, 1]);
|
||||
}
|
||||
|
||||
fn test_peekable_empty() {
|
||||
fn test_peekable_is_empty() {
|
||||
let a = [1];
|
||||
let mut it = a.iter().peekable();
|
||||
assert!( !it.empty() );
|
||||
assert!( !it.is_empty() );
|
||||
it.next();
|
||||
assert!( it.empty() );
|
||||
assert!( it.is_empty() );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user