about summary refs log tree commit diff
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-10-01 15:44:23 +0200
committerljedrz <ljedrz@gmail.com>2018-10-05 09:00:54 +0200
commit0ee6b54c2471a68b838bde42bfe48f1e91df1633 (patch)
treee186225032be4f0c5bac75cc2ce53dc0bb714d7f
parente153103c380c8ac88aea1ab0a200facf1e94aa1a (diff)
downloadrust-0ee6b54c2471a68b838bde42bfe48f1e91df1633.tar.gz
rust-0ee6b54c2471a68b838bde42bfe48f1e91df1633.zip
rustc/ty: move a faster early return up
-rw-r--r--src/librustc/ty/query/job.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs
index a1dc4f16ce9..321f2a66799 100644
--- a/src/librustc/ty/query/job.rs
+++ b/src/librustc/ty/query/job.rs
@@ -324,16 +324,16 @@ fn connected_to_root<'tcx>(
     query: Lrc<QueryJob<'tcx>>,
     visited: &mut FxHashSet<*const QueryJob<'tcx>>
 ) -> bool {
-    // We already visited this or we're deliberately ignoring it
-    if visited.contains(&query.as_ptr()) {
-        return false;
-    }
-
     // This query is connected to the root (it has no query parent), return true
     if query.parent.is_none() {
         return true;
     }
 
+    // We already visited this or we're deliberately ignoring it
+    if visited.contains(&query.as_ptr()) {
+        return false;
+    }
+
     visited.insert(query.as_ptr());
 
     let mut connected = false;