Skip to content

Commit

Permalink
refactor: Fix todo by using HashSet::difference (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Nov 17, 2022
1 parent 7b13174 commit d463a3e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions iroh/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit d463a3e

Please sign in to comment.