mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Use collect() for more idiomatic code in bluetooth.
This commit is contained in:
parent
1bc94c132e
commit
4e5d2e1c4f
1 changed files with 2 additions and 10 deletions
|
@ -19,11 +19,7 @@ impl ServiceUUIDSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_services_set(&self) -> HashSet<String> {
|
fn get_services_set(&self) -> HashSet<String> {
|
||||||
let mut set = HashSet::new();
|
self.0.iter().map(String::clone).collect()
|
||||||
for s in self.0.iter() {
|
|
||||||
set.insert(s.clone());
|
|
||||||
}
|
|
||||||
set
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +76,7 @@ impl BluetoothScanfilterSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_services_set(&self) -> HashSet<String> {
|
fn get_services_set(&self) -> HashSet<String> {
|
||||||
let mut set = HashSet::new();
|
self.iter().flat_map(|filter| filter.services.get_services_set()).collect()
|
||||||
for filter in self.iter() {
|
|
||||||
set = &set | &filter.services.get_services_set();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue