Skip to content

Commit d0e6936

Browse files
committed
refactor: simplify loop with map
1 parent d49aebd commit d0e6936

File tree

1 file changed

+1
-4
lines changed
  • src/packages/udp_tracker_core/services

1 file changed

+1
-4
lines changed

src/packages/udp_tracker_core/services/scrape.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ pub async fn handle_scrape(
3030
opt_udp_stats_event_sender: &Arc<Option<Box<dyn udp_tracker_core::statistics::event::sender::Sender>>>,
3131
) -> Result<ScrapeData, ScrapeError> {
3232
// Convert from aquatic infohashes
33-
let mut info_hashes: Vec<InfoHash> = vec![];
34-
for info_hash in &request.info_hashes {
35-
info_hashes.push((*info_hash).into());
36-
}
33+
let info_hashes: Vec<InfoHash> = request.info_hashes.iter().map(|&x| x.into()).collect();
3734

3835
let scrape_data = scrape_handler.scrape(&info_hashes).await?;
3936

0 commit comments

Comments
 (0)