Skip to content

Commit

Permalink
Simplify implementation of Bitv::{all,none} using iter builtins.
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriks committed Apr 17, 2014
1 parent 2334202 commit 03c5955
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/libcollections/bitv.rs
Expand Up @@ -415,10 +415,7 @@ impl Bitv {
pub fn all(&self) -> bool {
match self.rep {
Small(ref b) => b.all(self.nbits),
_ => {
for i in self.iter() { if !i { return false; } }
true
}
_ => self.iter().all(|x| x)
}
}

Expand All @@ -436,10 +433,7 @@ impl Bitv {
pub fn none(&self) -> bool {
match self.rep {
Small(ref b) => b.none(self.nbits),
Big(_) => {
for i in self.iter() { if i { return false; } }
true
}
_ => self.iter().all(|x| !x)
}
}

Expand Down

5 comments on commit 03c5955

@bors
Copy link
Contributor

@bors bors commented on 03c5955 Apr 18, 2014

Choose a reason for hiding this comment

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

saw approval from alexcrichton
at yuriks@03c5955

@bors
Copy link
Contributor

@bors bors commented on 03c5955 Apr 18, 2014

Choose a reason for hiding this comment

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

merging yuriks/rust/bitv-renames = 03c5955 into auto

@bors
Copy link
Contributor

@bors bors commented on 03c5955 Apr 18, 2014

Choose a reason for hiding this comment

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

yuriks/rust/bitv-renames = 03c5955 merged ok, testing candidate = 9503129

@bors
Copy link
Contributor

@bors bors commented on 03c5955 Apr 18, 2014

@bors
Copy link
Contributor

@bors bors commented on 03c5955 Apr 18, 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 = 9503129

Please sign in to comment.