Skip to content

Commit

Permalink
libcollections: remove init_to_vec
Browse files Browse the repository at this point in the history
The `init_to_vec` function in `collections::bitv` was exposed as an
inherent method, but appears to just be a helper function for the
`to_vec` method. This patch inlines the definition, removing
`init_to_vec` from the public API.

[breaking-change]
  • Loading branch information
aturon committed May 19, 2014
1 parent 42be687 commit a211907
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/libcollections/bitv.rs
Expand Up @@ -486,17 +486,13 @@ impl Bitv {
!self.none()
}

pub fn init_to_vec(&self, i: uint) -> uint {
return if self.get(i) { 1 } else { 0 };
}

/**
* Converts `self` to a vector of `uint` with the same length.
*
* Each `uint` in the resulting vector has either value `0u` or `1u`.
*/
pub fn to_vec(&self) -> Vec<uint> {
Vec::from_fn(self.nbits, |x| self.init_to_vec(x))
Vec::from_fn(self.nbits, |i| if self.get(i) { 1 } else { 0 })
}

/**
Expand Down

1 comment on commit a211907

@aturon
Copy link
Owner Author

@aturon aturon commented on a211907 May 19, 2014

Choose a reason for hiding this comment

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

r=alexcrichton

Please sign in to comment.