udp, ws load test: fix clippy errors

This commit is contained in:
Joakim Frostegård 2020-08-01 23:50:01 +02:00
parent d92b11191a
commit c202d9ba41
2 changed files with 20 additions and 20 deletions

View file

@ -10,12 +10,12 @@ use crate::config::Config;
pub fn clean_connections_and_torrents(state: &State){
let now = Instant::now();
{
let mut connections = state.connections.lock();
connections.retain(|_, v| v.0 > now);
connections.shrink_to_fit();
::std::mem::drop(connections);
}
let mut torrents = state.torrents.lock();
@ -101,6 +101,7 @@ pub fn gather_and_print_statistics(
let mut peers_per_torrent = Histogram::new();
{
let torrents = &mut state.torrents.lock();
for torrent in torrents.ipv4.values(){
@ -117,8 +118,7 @@ pub fn gather_and_print_statistics(
eprintln!("error incrementing peers_per_torrent histogram: {}", err)
}
}
::std::mem::drop(torrents);
}
if peers_per_torrent.entries() != 0 {
println!(

View file

@ -95,7 +95,7 @@ impl Connection {
connections.insert(*token_counter, connection);
*token_counter = *token_counter + 1;
*token_counter += 1;
Ok(())
}