Skip to content
Permalink
Browse files

Replaced trivial pattern matching with is_none() and is_some()

  • Loading branch information...
Permutatrix committed Jan 4, 2017
1 parent a61a263 commit 6a7652510793078daf93d2b405da02c68e3ef88e
Showing with 6 additions and 8 deletions.
  1. +6 −8 components/layout/query.rs
@@ -539,13 +539,11 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) {
match self.node_offset_box {
Some(_) => { }, // We've already found the node, so we already have its parent.
None => {
// Remove all nodes at this level or higher, as they can't be parents of this node.
self.parent_nodes.truncate(level as usize);
assert!(self.parent_nodes.len() == level as usize);
},
if self.node_offset_box.is_none() {
// We haven't found the node yet, so we're still looking for its parent.
// Remove all nodes at this level or higher, as they can't be parents of this node.
self.parent_nodes.truncate(level as usize);
assert!(self.parent_nodes.len() == level as usize);
}

if fragment.node == self.node_address {
@@ -581,7 +579,7 @@ impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
// TODO: `position: fixed` on inline elements doesn't seem to work
// as of Sep 25, 2016, so I don't know how one will check if an
// inline element has it when it does.
} else if let Some(_) = self.node_offset_box {
} else if self.node_offset_box.is_some() {
// We've been processing fragments within the node, but now
// we've found one outside it. That means we're done.
// Hopefully.

0 comments on commit 6a76525

Please sign in to comment.
You can’t perform that action at this time.