diff options
author | Corey Farwell <coreyf@rwell.org> | 2017-12-28 18:17:45 -0800 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2017-12-28 18:17:45 -0800 |
commit | 2529319f68b782fa8531982e60818c0af4e11545 (patch) | |
tree | 1507befd31f659644c753c82f3b2d65f23a9c8bf /src | |
parent | 8ba5805bae97c8defd92bfdc06fb3c6046439af3 (diff) | |
download | tor-2529319f68b782fa8531982e60818c0af4e11545.tar.gz tor-2529319f68b782fa8531982e60818c0af4e11545.zip |
[fixup] this might be an improvement?
Diffstat (limited to 'src')
-rw-r--r-- | src/rust/protover/protover.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs index 60bdc9d833..5e281a3e92 100644 --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@ -99,13 +99,17 @@ pub fn get_supported_protocols() -> String { } /// Translates a vector representation of a protocol list into a HashMap -fn parse_protocols<'a, P: Iterator<Item = &'a str>>( +fn parse_protocols<P, S>( protocols: P, -) -> Result<HashMap<Proto, HashSet<u32>>, &'static str> { +) -> Result<HashMap<Proto, HashSet<u32>>, &'static str> +where + P: Iterator<Item = S>, + S: AsRef<str>, +{ let mut parsed = HashMap::new(); for subproto in protocols { - let (name, version) = get_proto_and_vers(subproto)?; + let (name, version) = get_proto_and_vers(subproto.as_ref())?; parsed.insert(name, version); } Ok(parsed) @@ -130,7 +134,7 @@ fn parse_protocols_from_string<'a>( /// of the error. /// fn tor_supported() -> Result<HashMap<Proto, HashSet<u32>>, &'static str> { - parse_protocols(SUPPORTED_PROTOCOLS.iter().map(|n| *n)) + parse_protocols(SUPPORTED_PROTOCOLS.iter()) } /// Get the unique version numbers supported by a subprotocol. |