]> git.lizzy.rs Git - rust.git/commitdiff
libcollections: remove `init_to_vec`
authorAaron Turon <aturon@mozilla.com>
Mon, 19 May 2014 18:46:29 +0000 (11:46 -0700)
committerAaron Turon <aturon@mozilla.com>
Mon, 19 May 2014 20:50:03 +0000 (13:50 -0700)
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]

src/libcollections/bitv.rs

index 871584b669e75a079f7175104ade16ed5c8ffb53..e2934efa43b65b5e42df828a7363e60c1e058c0c 100644 (file)
@@ -486,17 +486,13 @@ pub fn any(&self) -> bool {
         !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 })
     }
 
     /**