From d463a3ecb801393ae166692945843578a97df0bd Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 17 Nov 2022 03:19:42 +0100 Subject: [PATCH] refactor: Fix todo by using HashSet::difference (#505) --- iroh/src/services.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/iroh/src/services.rs b/iroh/src/services.rs index aa3b1ac668..7d75e4a680 100644 --- a/iroh/src/services.rs +++ b/iroh/src/services.rs @@ -5,6 +5,7 @@ use futures::StreamExt; use iroh_util::iroh_cache_path; use std::collections::HashSet; use std::io::{stdout, Write}; +use std::ops::Deref; use std::time::SystemTime; use sysinfo::PidExt; use tracing::info; @@ -80,11 +81,9 @@ async fn start_services(api: &Api, services: HashSet<&str>) -> Result<()> { accum }); - // TODO (b5) - use services.difference here, but figure out how to - // .collect() to &str instead of &&str let missing_services: HashSet<&str> = services - .into_iter() - .filter(|&service| missing_services.contains(service)) + .difference(missing_services) + .map(Deref::deref) .collect(); if missing_services.is_empty() {