]> git.lizzy.rs Git - rust.git/commitdiff
rustc/ty: move a faster early return up
authorljedrz <ljedrz@gmail.com>
Mon, 1 Oct 2018 13:44:23 +0000 (15:44 +0200)
committerljedrz <ljedrz@gmail.com>
Fri, 5 Oct 2018 07:00:54 +0000 (09:00 +0200)
src/librustc/ty/query/job.rs

index a1dc4f16ce999e1c9c022a400d9e728d673c2cc4..321f2a66799c73a8a72f602414c1daab277a5a1b 100644 (file)
@@ -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;