Skip to content

Commit 393a4b4

Browse files
committed
Favor local closures instead of global functions
1 parent dc7e6ab commit 393a4b4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/libstd/bitv.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,22 @@ impl BigBitv {
164164

165165
#[inline(always)]
166166
fn union(&mut self, b: &BigBitv, nbits: uint) -> bool {
167-
self.process(b, nbits, lor)
167+
self.process(b, nbits, |w1, w2| w1 | w2)
168168
}
169169

170170
#[inline(always)]
171171
fn intersect(&mut self, b: &BigBitv, nbits: uint) -> bool {
172-
self.process(b, nbits, land)
172+
self.process(b, nbits, |w1, w2| w1 & w2)
173173
}
174174

175175
#[inline(always)]
176176
fn become(&mut self, b: &BigBitv, nbits: uint) -> bool {
177-
self.process(b, nbits, right)
177+
self.process(b, nbits, |_, w| w)
178178
}
179179

180180
#[inline(always)]
181181
fn difference(&mut self, b: &BigBitv, nbits: uint) -> bool {
182-
self.process(b, nbits, difference)
182+
self.process(b, nbits, |w1, w2| w1 & !w2)
183183
}
184184

185185
#[inline(always)]
@@ -556,13 +556,9 @@ pub fn from_fn(len: uint, f: fn(index: uint) -> bool) -> Bitv {
556556
bitv
557557
}
558558
559-
pure fn lor(w0: uint, w1: uint) -> uint { return w0 | w1; }
560559
561-
pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; }
562560
563-
pure fn difference(w0: uint, w1: uint) -> uint { return w0 & !w1; }
564561
565-
pure fn right(_w0: uint, w1: uint) -> uint { return w1; }
566562
567563
impl ops::Index<uint,bool> for Bitv {
568564
pure fn index(&self, i: uint) -> bool {

0 commit comments

Comments
 (0)