[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/release-0.3.4] rust/protover: delete ProtoSet::retain



commit 5c47f725b0e1628aab1d6f5b43dc32a493ce58e8
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Wed Aug 15 03:23:08 2018 +0000

    rust/protover: delete ProtoSet::retain
    
    As the comment noted, it was horribly inefficient.
---
 src/rust/protover/protoset.rs | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/src/rust/protover/protoset.rs b/src/rust/protover/protoset.rs
index 27c16c700..465b8f285 100644
--- a/src/rust/protover/protoset.rs
+++ b/src/rust/protover/protoset.rs
@@ -242,36 +242,6 @@ impl ProtoSet {
         false
     }
 
-    /// Retain only the `Version`s in this `ProtoSet` for which the predicate
-    /// `F` returns `true`.
-    ///
-    /// # Examples
-    ///
-    /// ```
-    /// # use protover::errors::ProtoverError;
-    /// use protover::protoset::ProtoSet;
-    ///
-    /// # fn do_test() -> Result<bool, ProtoverError> {
-    /// let mut protoset: ProtoSet = "1,3-5,9".parse()?;
-    ///
-    /// // Keep only versions less than or equal to 8:
-    /// protoset.retain(|x| x <= &8);
-    ///
-    /// assert_eq!(protoset.expand(), vec![1, 3, 4, 5]);
-    /// #
-    /// # Ok(true)
-    /// # }
-    /// # fn main() { do_test(); }  // wrap the test so we can use the ? operator
-    /// ```
-    // XXX we could probably do something more efficient here. â??isis
-    pub fn retain<F>(&mut self, f: F)
-        where F: FnMut(&Version) -> bool
-    {
-        let mut expanded: Vec<Version> = self.clone().expand();
-        expanded.retain(f);
-        *self = expanded.into();
-    }
-
     /// Returns all the `Version`s in `self` which are not also in the `other`
     /// `ProtoSet`.
     ///



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits