diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-06-25 22:31:48 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-06-25 22:34:00 +0200 |
commit | b6e5f8e7b6d5b8013cd967a533c9400690f69b0a (patch) | |
tree | 44cd53325c5e380b7f3ab106cc51045f086e40e4 /components/layout/parallel.rs | |
parent | b98a7f27a90b8677a63900a7feaafcd0ee840b39 (diff) | |
download | servo-b6e5f8e7b6d5b8013cd967a533c9400690f69b0a.tar.gz servo-b6e5f8e7b6d5b8013cd967a533c9400690f69b0a.zip |
Reduce the scope of the unsafe block in ParallelPostorderDomTraversal.
Diffstat (limited to 'components/layout/parallel.rs')
-rw-r--r-- | components/layout/parallel.rs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 89b4e8cecea..1792e41aa6d 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -186,22 +186,21 @@ trait ParallelPostorderDomTraversal : PostorderDomTraversal { Some(parent) => parent, }; - unsafe { - let parent_layout_data = - (*parent.borrow_layout_data_unchecked()).as_ref().expect("no layout data"); - - unsafe_node = layout_node_to_unsafe_layout_node(&parent); - - if parent_layout_data - .data - .parallel - .children_count - .fetch_sub(1, Ordering::Relaxed) == 1 { - // We were the last child of our parent. Construct flows for our parent. - } else { - // Get out of here and find another node to work on. - break - } + let parent_layout_data = unsafe { + &*parent.borrow_layout_data_unchecked() + }; + let parent_layout_data = parent_layout_data.as_ref().expect("no layout data"); + unsafe_node = layout_node_to_unsafe_layout_node(&parent); + + if parent_layout_data + .data + .parallel + .children_count + .fetch_sub(1, Ordering::Relaxed) == 1 { + // We were the last child of our parent. Construct flows for our parent. + } else { + // Get out of here and find another node to work on. + break } } } |