about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-04-27 19:30:16 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-04-28 03:43:35 +0000
commitac264196e2f4c1f3de8b081f72dc78838e423085 (patch)
tree58494e80cceab11f1085c828b54827bd23888c67
parent6aa91457535a1bc5433eec5f2bc5630e13b04895 (diff)
downloadrust-ac264196e2f4c1f3de8b081f72dc78838e423085.tar.gz
rust-ac264196e2f4c1f3de8b081f72dc78838e423085.zip
Address style nits
-rw-r--r--src/librustc/ty/mod.rs8
-rw-r--r--src/librustc_resolve/lib.rs4
2 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 0c23f533298..bc342b235dd 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -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
     }
 }
 
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index fdb834a32fb..1674a96c8ba 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -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
     }
 }