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

5 comments on commit a211907

@bors
Copy link
Contributor

@bors bors commented on a211907 May 20, 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 aturon@a211907

@bors
Copy link
Contributor

@bors bors commented on a211907 May 20, 2014

Choose a reason for hiding this comment

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

merging aturon/rust/hide-init_to_vec = a211907 into auto

@bors
Copy link
Contributor

@bors bors commented on a211907 May 20, 2014

Choose a reason for hiding this comment

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

aturon/rust/hide-init_to_vec = a211907 merged ok, testing candidate = e9018f9

@bors
Copy link
Contributor

@bors bors commented on a211907 May 20, 2014

@bors
Copy link
Contributor

@bors bors commented on a211907 May 20, 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 = e9018f9

Please sign in to comment.