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

This commit is contained in:
Permutator 2017-01-04 15:37:16 -08:00
parent a61a263291
commit 6a76525107
No known key found for this signature in database
GPG key ID: 62D7A8D792C3B058

View file

@ -539,13 +539,11 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
// https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface // https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface
impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator { impl FragmentBorderBoxIterator for ParentOffsetBorderBoxIterator {
fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) { fn process(&mut self, fragment: &Fragment, level: i32, border_box: &Rect<Au>) {
match self.node_offset_box { if self.node_offset_box.is_none() {
Some(_) => { }, // We've already found the node, so we already have its parent. // We haven't found the node yet, so we're still looking for its parent.
None => { // Remove all nodes at this level or higher, as they can't be parents of this node.
// Remove all nodes at this level or higher, as they can't be parents of this node. self.parent_nodes.truncate(level as usize);
self.parent_nodes.truncate(level as usize); assert!(self.parent_nodes.len() == level as usize);
assert!(self.parent_nodes.len() == level as usize);
},
} }
if fragment.node == self.node_address { 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 // 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 // as of Sep 25, 2016, so I don't know how one will check if an
// inline element has it when it does. // 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 been processing fragments within the node, but now
// we've found one outside it. That means we're done. // we've found one outside it. That means we're done.
// Hopefully. // Hopefully.