Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use collect() for more idiomatic code in bluetooth. #11635

Merged
merged 1 commit into from Jun 6, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Use collect() for more idiomatic code in bluetooth.

  • Loading branch information
Ms2ger committed Jun 6, 2016
commit 4e5d2e1c4f90b10d0c97d84b08e75aec28f28aab
@@ -19,11 +19,7 @@ impl ServiceUUIDSequence {
}

fn get_services_set(&self) -> HashSet<String> {
let mut set = HashSet::new();
for s in self.0.iter() {
set.insert(s.clone());
}
set
self.0.iter().map(String::clone).collect()
}
}

@@ -80,11 +76,7 @@ impl BluetoothScanfilterSequence {
}

fn get_services_set(&self) -> HashSet<String> {
let mut set = HashSet::new();
for filter in self.iter() {
set = &set | &filter.services.get_services_set();
}
set
self.iter().flat_map(|filter| filter.services.get_services_set()).collect()
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.