Address style nits
This commit is contained in:
parent
6aa9145753
commit
ac264196e2
2 changed files with 7 additions and 5 deletions
|
@ -290,12 +290,14 @@ pub trait NodeIdTree {
|
||||||
impl<'a> NodeIdTree for ast_map::Map<'a> {
|
impl<'a> NodeIdTree for ast_map::Map<'a> {
|
||||||
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
|
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
|
||||||
let mut node_ancestor = node;
|
let mut node_ancestor = node;
|
||||||
loop {
|
while node_ancestor != ancestor {
|
||||||
if node_ancestor == ancestor { return true }
|
|
||||||
let node_ancestor_parent = self.get_module_parent(node_ancestor);
|
let node_ancestor_parent = self.get_module_parent(node_ancestor);
|
||||||
if node_ancestor_parent == node_ancestor { return false }
|
if node_ancestor_parent == node_ancestor {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
node_ancestor = node_ancestor_parent;
|
node_ancestor = node_ancestor_parent;
|
||||||
}
|
}
|
||||||
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1125,14 +1125,14 @@ impl<'a, 'tcx> ty::NodeIdTree for Resolver<'a, 'tcx> {
|
||||||
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
|
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
|
||||||
let ancestor = self.ast_map.local_def_id(ancestor);
|
let ancestor = self.ast_map.local_def_id(ancestor);
|
||||||
let mut module = *self.module_map.get(&node).unwrap();
|
let mut module = *self.module_map.get(&node).unwrap();
|
||||||
loop {
|
while module.def_id() != Some(ancestor) {
|
||||||
if module.def_id() == Some(ancestor) { return true; }
|
|
||||||
let module_parent = match self.get_nearest_normal_module_parent(module) {
|
let module_parent = match self.get_nearest_normal_module_parent(module) {
|
||||||
Some(parent) => parent,
|
Some(parent) => parent,
|
||||||
None => return false,
|
None => return false,
|
||||||
};
|
};
|
||||||
module = module_parent;
|
module = module_parent;
|
||||||
}
|
}
|
||||||
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue