Skip to content

Commit

Permalink
Cleanup trait search
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Mar 26, 2016
1 parent 60a836f commit e011ae5
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3233,18 +3233,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}

let mut found_traits = Vec::new();
let mut search_module = self.current_module;
loop {
// Look for the current trait.
match self.current_trait_ref {
Some((trait_def_id, _)) => {
if self.trait_item_map.contains_key(&(name, trait_def_id)) {
add_trait_info(&mut found_traits, trait_def_id, name);
}
}
None => {} // Nothing to do.
// Look for the current trait.
if let Some((trait_def_id, _)) = self.current_trait_ref {
if self.trait_item_map.contains_key(&(name, trait_def_id)) {
add_trait_info(&mut found_traits, trait_def_id, name);
}
}

let mut search_module = self.current_module;
loop {
// Look for trait children.
let mut search_in_module = |module: Module<'a>| module.for_each_child(|_, ns, binding| {
if ns != TypeNS { return }
Expand Down

0 comments on commit e011ae5

Please sign in to comment.