summaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2018-08-15 03:23:08 +0000
committercypherpunks <cypherpunks@torproject.org>2018-09-14 15:10:22 +0000
commit5c47f725b0e1628aab1d6f5b43dc32a493ce58e8 (patch)
tree146fc1b9ce7dc061752a43c8a0dbaa14d7a8fe0e /src/rust
parentc613d5513491861431c2852cf4072ae256ba2c67 (diff)
downloadtor-5c47f725b0e1628aab1d6f5b43dc32a493ce58e8.tar.gz
tor-5c47f725b0e1628aab1d6f5b43dc32a493ce58e8.zip
rust/protover: delete ProtoSet::retain
As the comment noted, it was horribly inefficient.
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/protover/protoset.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/rust/protover/protoset.rs b/src/rust/protover/protoset.rs
index 27c16c7005..465b8f2850 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`.
///