Skip to content

Commit 0576a40

Browse files
committed
some huon fixes
1 parent a392180 commit 0576a40

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libcollections/bit.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ use std::hash;
8787

8888
use vec::Vec;
8989

90-
type Blocks<'a> = Take<Cloned<Items<'a, u32>>>;
90+
type Blocks<'a> = Cloned<Items<'a, u32>>
91+
type MutBlocks<'a> MutItems<'a, u32>;
9192
type MatchWords<'a> = Chain<Enumerate<Blocks<'a>>, Skip<Take<Enumerate<Repeat<u32>>>>>;
9293

9394
// Take two BitV's, and return iterators of their words, where the shorter one
@@ -196,15 +197,15 @@ impl Bitv {
196197
}
197198

198199
/// Iterator over mutable refs to the underlying blocks of data.
199-
fn blocks_mut(&mut self) -> Take<MutItems<u32>> {
200+
fn blocks_mut(&mut self) -> MutBlocks {
200201
let blocks = blocks_for_bits(self.len());
201-
self.storage.iter_mut().take(blocks)
202+
self.storage[..blocks].iter_mut()
202203
}
203204

204205
/// Iterator over the underlying blocks of data
205-
fn blocks(&self) -> Take<Cloned<Items<u32>>> {
206+
fn blocks(&self) -> Blocks {
206207
let blocks = blocks_for_bits(self.len());
207-
self.storage.iter().cloned().take(blocks)
208+
self.storage[..blocks].iter().cloned()
208209
}
209210

210211
/// An operation might screw up the unused bits in the last block of the Bitv.
@@ -259,7 +260,7 @@ impl Bitv {
259260

260261
/// Constructs a new, empty `Bitv` with the specified capacity.
261262
///
262-
/// The bitvector will be able to hold exactly `capacity` bits without
263+
/// The bitvector will be able to hold at least `capacity` bits without
263264
/// reallocating. If `capacity` is 0, it will not allocate.
264265
///
265266
/// It is important to note that this function does not specify the

0 commit comments

Comments
 (0)