diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-01 14:50:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-01 14:50:36 -0500 |
commit | ff53d7a02aced68d3bf64e1ca679061768183f69 (patch) | |
tree | 65fc0d9677a2763d9f44a035b14f5f449a829e67 | |
parent | b097751211a9a0a1ac26db1aeb60fe3304f8148d (diff) | |
parent | 68f497c962a5c9468f78eed0a78d10b5bb1c3354 (diff) |
Auto merge of #185 - fitzgen:whitelisted-items, r=emilio
Avoid an extra lookup when finding new whitelisted items to traverse
`insert()` returns `true` if the item was *not* in the set before, so we can use that to avoid a double lookup.
r? @emilio
-rw-r--r-- | src/ir/context.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs index 7e824be1..6c56eefe 100644 --- a/src/ir/context.rs +++ b/src/ir/context.rs @@ -922,9 +922,8 @@ impl<'ctx, 'gen> Iterator for WhitelistedItemsIter<'ctx, 'gen> id.collect_types(self.ctx, &mut sub_types, &()); for id in sub_types { - if !self.seen.contains(&id) { + if self.seen.insert(id) { self.to_iterate.push(id); - self.seen.insert(id); } } |