Fixed bunch of clippy warnings (#427)

This commit is contained in:
Jędrzej Stuczyński
2020-11-10 15:28:55 +00:00
committed by GitHub
parent 7d694194ca
commit 69eefaf91f
43 changed files with 102 additions and 152 deletions
@@ -67,7 +67,7 @@ impl KeyCache {
pub(super) fn insert(&self, key: SharedSecret, cached_keys: CachedKeys) -> bool {
trace!("inserting {:?} into the cache", key);
let insertion_result = self.vpn_key_cache.insert(key.clone(), cached_keys);
let insertion_result = self.vpn_key_cache.insert(key, cached_keys);
if !insertion_result {
debug!("{:?} was put into the cache", key);
// this shouldn't really happen, but don't insert entry to invalidator if it was already
@@ -352,7 +352,7 @@ mod tests {
let initial_secret = final_hop.shared_secret();
let processed = final_hop.process(&processor.sphinx_key).unwrap();
processor.cache_keys(initial_secret.clone(), &processed);
processor.cache_keys(initial_secret, &processed);
let cache_entry = processor.vpn_key_cache.get(&initial_secret).unwrap();
let (cached_secret, cached_routing_keys) = cache_entry.value();
@@ -376,7 +376,7 @@ mod tests {
let initial_secret = forward_hop.shared_secret();
let processed = forward_hop.process(&processor.sphinx_key).unwrap();
processor.cache_keys(initial_secret.clone(), &processed);
processor.cache_keys(initial_secret, &processed);
let cache_entry = processor.vpn_key_cache.get(&initial_secret).unwrap();
let (cached_secret, cached_routing_keys) = cache_entry.value();
@@ -463,7 +463,7 @@ mod tests {
let long_data = vec![42u8; SURBAck::len() * 5];
let (ack, data) = processor
.split_hop_data_into_ack_and_message(long_data.clone())
.split_hop_data_into_ack_and_message(long_data)
.unwrap();
assert_eq!(ack.len(), SURBAck::len());
assert_eq!(data.len(), SURBAck::len() * 4)