style(reflector): Reorder imports and truncate vector

This commit is contained in:
Nils Andreas Svee committed 2026-02-21 22:42:20 +07:00
1 parent 127ed692c3
commit 99a7928a66
1 file changed
+2 -2
+2 -2
View File
@@ -1,7 +1,7 @@
use crate::{Config, ReflectorStats}; use crate::{Config, ReflectorStats};
use log::{debug, info}; use log::{debug, info};
use rand::seq::IndexedRandom; use rand::seq::IndexedRandom;
use rand::{rng, RngExt}; use rand::{RngExt, rng};
use std::collections::HashMap; use std::collections::HashMap;
use std::net::IpAddr; use std::net::IpAddr;
use std::sync::mpsc::Receiver; use std::sync::mpsc::Receiver;
@@ -102,7 +102,7 @@ impl ReflectorSelector {
// Now we will just limit the candidates down to 2 * num_reflectors // Now we will just limit the candidates down to 2 * num_reflectors
let mut num_reflectors = self.config.num_reflectors; let mut num_reflectors = self.config.num_reflectors;
let candidate_pool_num = (2 * num_reflectors) as usize; let candidate_pool_num = (2 * num_reflectors) as usize;
candidates = candidates[0..candidate_pool_num - 1].to_vec(); candidates.truncate(candidate_pool_num);
for (candidate, rtt) in candidates.iter() { for (candidate, rtt) in candidates.iter() {
info!("Fastest candidate {}: {}", candidate, rtt); info!("Fastest candidate {}: {}", candidate, rtt);