tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 69502942b00ecc944437894b40b286cbfa3df928
parent 12f58b42a8adfeee09b140819819eee4108e22d8
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri, 27 Oct 2017 13:02:14 -0400

[rust] Avoid a clone in contract_protocol_list()

Diffstat:
Msrc/rust/protover/protover.rs | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 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();