Skip to content

Commit 03c5955

Browse files
committed
Simplify implementation of Bitv::{all,none} using iter builtins.
1 parent 2334202 commit 03c5955

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/libcollections/bitv.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,7 @@ impl Bitv {
415415
pub fn all(&self) -> bool {
416416
match self.rep {
417417
Small(ref b) => b.all(self.nbits),
418-
_ => {
419-
for i in self.iter() { if !i { return false; } }
420-
true
421-
}
418+
_ => self.iter().all(|x| x)
422419
}
423420
}
424421

@@ -436,10 +433,7 @@ impl Bitv {
436433
pub fn none(&self) -> bool {
437434
match self.rep {
438435
Small(ref b) => b.none(self.nbits),
439-
Big(_) => {
440-
for i in self.iter() { if i { return false; } }
441-
true
442-
}
436+
_ => self.iter().all(|x| !x)
443437
}
444438
}
445439

0 commit comments

Comments
 (0)