Skip to content

Commit

Permalink
Use iterator and collect instead of mut and insert (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 authored May 12, 2021
1 parent 220d835 commit 7ad7655
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions crates/gen/src/tables/type_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,16 @@ impl TypeDef {
}

pub fn overridable_methods(&self) -> BTreeSet<&'static str> {
let mut methods = BTreeSet::new();

for interface in self
.interface_impls()
self.interface_impls()
.filter(|interface| interface.is_overridable())
{
for method in interface.interface().resolve().methods() {
methods.insert(method.name());
}
}

methods
.flat_map(|interface| {
interface
.interface()
.resolve()
.methods()
.map(|method| method.name())
})
.collect()
}

pub fn gen_name(&self, gen: &Gen) -> TokenStream {
Expand Down

0 comments on commit 7ad7655

Please sign in to comment.