mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
Explicity use IndexMap::swap_remove to silence warnings
This commit is contained in:
parent
0b6a02e1a7
commit
e705c03981
4 changed files with 6 additions and 6 deletions
|
|
@ -433,7 +433,7 @@ impl<I: Ip> LargePeerMap<I> {
|
|||
}
|
||||
|
||||
fn remove_peer(&mut self, key: &ResponsePeer<I>) -> Option<Peer> {
|
||||
let opt_removed_peer = self.peers.remove(key);
|
||||
let opt_removed_peer = self.peers.swap_remove(key);
|
||||
|
||||
if let Some(Peer {
|
||||
is_seeder: true, ..
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ pub fn run_statistics_worker(
|
|||
*count -= 1;
|
||||
|
||||
if *count == 0 {
|
||||
peers.remove(&peer_id);
|
||||
peers.swap_remove(&peer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ impl<I: Ip> LargePeerMap<I> {
|
|||
}
|
||||
|
||||
fn remove_peer(&mut self, key: &ResponsePeer<I>) -> Option<Peer> {
|
||||
let opt_removed_peer = self.peers.remove(key);
|
||||
let opt_removed_peer = self.peers.swap_remove(key);
|
||||
|
||||
if let Some(Peer {
|
||||
is_seeder: true, ..
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ impl TorrentData {
|
|||
peer.valid_until = valid_until;
|
||||
}
|
||||
PeerStatus::Stopped => {
|
||||
let peer = entry.remove();
|
||||
let peer = entry.swap_remove();
|
||||
|
||||
if peer.seeder {
|
||||
self.num_seeders -= 1;
|
||||
|
|
@ -477,7 +477,7 @@ impl TorrentData {
|
|||
|
||||
if answer_receiver
|
||||
.expecting_answers
|
||||
.remove(&expecting_answer)
|
||||
.swap_remove(&expecting_answer)
|
||||
.is_some()
|
||||
{
|
||||
let answer_out_message = AnswerOutMessage {
|
||||
|
|
@ -519,7 +519,7 @@ impl TorrentData {
|
|||
peer_id: PeerId,
|
||||
#[cfg(feature = "metrics")] peer_gauge: &::metrics::Gauge,
|
||||
) {
|
||||
if let Some(peer) = self.peers.remove(&peer_id) {
|
||||
if let Some(peer) = self.peers.swap_remove(&peer_id) {
|
||||
if peer.seeder {
|
||||
self.num_seeders -= 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue