提交 ac264196 编写于 作者: J Jeffrey Seyfried

Address style nits

上级 6aa91457
......@@ -290,12 +290,14 @@ pub trait NodeIdTree {
impl<'a> NodeIdTree for ast_map::Map<'a> {
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
let mut node_ancestor = node;
loop {
if node_ancestor == ancestor { return true }
while node_ancestor != 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;
}
true
}
}
......
......@@ -1125,14 +1125,14 @@ impl<'a, 'tcx> ty::NodeIdTree for Resolver<'a, 'tcx> {
fn is_descendant_of(&self, node: NodeId, ancestor: NodeId) -> bool {
let ancestor = self.ast_map.local_def_id(ancestor);
let mut module = *self.module_map.get(&node).unwrap();
loop {
if module.def_id() == Some(ancestor) { return true; }
while module.def_id() != Some(ancestor) {
let module_parent = match self.get_nearest_normal_module_parent(module) {
Some(parent) => parent,
None => return false,
};
module = module_parent;
}
true
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册