aboutsummaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-27 13:02:14 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-27 13:02:14 -0400
commit69502942b00ecc944437894b40b286cbfa3df928 (patch)
tree290c576cd809f075825637200e04510f064f1039 /src/rust
parent12f58b42a8adfeee09b140819819eee4108e22d8 (diff)
downloadtor-69502942b00ecc944437894b40b286cbfa3df928.tar.gz
tor-69502942b00ecc944437894b40b286cbfa3df928.zip
[rust] Avoid a clone in contract_protocol_list()
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/protover/protover.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 11e9d0079e..f19f7972fd 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -429,8 +429,9 @@ fn find_range(list: &Vec<u32>) -> (bool, u32) {
/// A `String` representation of this set in ascending order.
///
fn contract_protocol_list<'a>(supported_set: &'a HashSet<u32>) -> String {
- let mut supported_clone = supported_set.clone();
- let mut supported: Vec<u32> = supported_clone.drain().collect();
+ let mut supported: Vec<u32> = supported_set.iter()
+ .map(|x| *x)
+ .collect();
supported.sort();
let mut final_output: Vec<String> = Vec::new();