mirror of
https://github.com/servo/servo.git
synced 2025-08-11 08:25:32 +01:00
Replace .map_or(false with Option::is_some_and (#33468)
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
236cae9ce5
commit
7df30f3788
51 changed files with 165 additions and 171 deletions
|
@ -678,7 +678,7 @@ impl StackingContext {
|
|||
|
||||
// Steps 1 and 2: Borders and background for the root
|
||||
let mut contents = self.contents.iter().enumerate().peekable();
|
||||
while contents.peek().map_or(false, |(_, child)| {
|
||||
while contents.peek().is_some_and(|(_, child)| {
|
||||
child.section() == StackingContextSection::OwnBackgroundsAndBorders
|
||||
}) {
|
||||
let (i, child) = contents.next().unwrap();
|
||||
|
@ -694,7 +694,7 @@ impl StackingContext {
|
|||
.peekable();
|
||||
while real_stacking_contexts_and_positioned_stacking_containers
|
||||
.peek()
|
||||
.map_or(false, |(_, child)| child.z_index() < 0)
|
||||
.is_some_and(|(_, child)| child.z_index() < 0)
|
||||
{
|
||||
let (i, child) = real_stacking_contexts_and_positioned_stacking_containers
|
||||
.next()
|
||||
|
@ -707,7 +707,7 @@ impl StackingContext {
|
|||
}
|
||||
|
||||
// Step 4: Block backgrounds and borders
|
||||
while contents.peek().map_or(false, |(_, child)| {
|
||||
while contents.peek().is_some_and(|(_, child)| {
|
||||
child.section() == StackingContextSection::DescendantBackgroundsAndBorders
|
||||
}) {
|
||||
let (i, child) = contents.next().unwrap();
|
||||
|
@ -722,9 +722,10 @@ impl StackingContext {
|
|||
}
|
||||
|
||||
// Steps 6 and 7: Fragments and inline stacking containers
|
||||
while contents.peek().map_or(false, |(_, child)| {
|
||||
child.section() == StackingContextSection::Foreground
|
||||
}) {
|
||||
while contents
|
||||
.peek()
|
||||
.is_some_and(|(_, child)| child.section() == StackingContextSection::Foreground)
|
||||
{
|
||||
let (i, child) = contents.next().unwrap();
|
||||
self.debug_push_print_item(DebugPrintField::Contents, i);
|
||||
child.build_display_list(builder, &self.atomic_inline_stacking_containers);
|
||||
|
@ -741,9 +742,10 @@ impl StackingContext {
|
|||
}
|
||||
|
||||
// Step 10: Outline
|
||||
while contents.peek().map_or(false, |(_, child)| {
|
||||
child.section() == StackingContextSection::Outline
|
||||
}) {
|
||||
while contents
|
||||
.peek()
|
||||
.is_some_and(|(_, child)| child.section() == StackingContextSection::Outline)
|
||||
{
|
||||
let (i, child) = contents.next().unwrap();
|
||||
self.debug_push_print_item(DebugPrintField::Contents, i);
|
||||
child.build_display_list(builder, &self.atomic_inline_stacking_containers);
|
||||
|
|
|
@ -56,7 +56,7 @@ impl<'dom, Node: NodeExt<'dom>> NodeAndStyleInfo<Node> {
|
|||
}
|
||||
|
||||
pub(crate) fn is_single_line_text_input(&self) -> bool {
|
||||
self.node.map_or(false, |node| {
|
||||
self.node.is_some_and(|node| {
|
||||
node.type_id() == LayoutNodeType::Element(LayoutElementType::HTMLInputElement)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ impl TextRunSegment {
|
|||
let mut ends_with_whitespace = false;
|
||||
let ends_with_newline = rev_char_indices
|
||||
.peek()
|
||||
.map_or(false, |&(_, character)| character == '\n');
|
||||
.is_some_and(|&(_, character)| character == '\n');
|
||||
if let Some((first_white_space_index, first_white_space_character)) = rev_char_indices
|
||||
.take_while(|&(_, character)| char_is_whitespace(character))
|
||||
.last()
|
||||
|
|
|
@ -70,9 +70,11 @@ impl BoxTree {
|
|||
let mut root_overflow = root_style.effective_overflow().y;
|
||||
if root_overflow == Overflow::Visible && !root_style.get_box().display.is_none() {
|
||||
for child in iter_child_nodes(root_element) {
|
||||
if !child.to_threadsafe().as_element().map_or(false, |element| {
|
||||
element.is_body_element_of_html_element_root()
|
||||
}) {
|
||||
if !child
|
||||
.to_threadsafe()
|
||||
.as_element()
|
||||
.is_some_and(|element| element.is_body_element_of_html_element_root())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -245,9 +245,9 @@ fn resolved_size_should_be_used_value(fragment: &Fragment) -> bool {
|
|||
match fragment {
|
||||
Fragment::Box(box_fragment) => {
|
||||
!box_fragment.style.get_box().display.is_inline_flow() ||
|
||||
fragment.base().map_or(false, |base| {
|
||||
base.flags.contains(FragmentFlags::IS_REPLACED)
|
||||
})
|
||||
fragment
|
||||
.base()
|
||||
.is_some_and(|base| base.flags.contains(FragmentFlags::IS_REPLACED))
|
||||
},
|
||||
Fragment::Float(_) |
|
||||
Fragment::Positioning(_) |
|
||||
|
|
|
@ -1209,9 +1209,9 @@ impl<'a> TableLayout<'a> {
|
|||
// configuration for whatever PositioningContext the contents are ultimately added to.
|
||||
let collect_for_nearest_positioned_ancestor = parent_positioning_context
|
||||
.collects_for_nearest_positioned_ancestor() ||
|
||||
self.table.rows.get(row_index).map_or(false, |row| {
|
||||
self.table.rows.get(row_index).is_some_and(|row| {
|
||||
let row_group_collects_for_nearest_positioned_ancestor =
|
||||
row.group_index.map_or(false, |group_index| {
|
||||
row.group_index.is_some_and(|group_index| {
|
||||
self.table.row_groups[group_index]
|
||||
.style
|
||||
.establishes_containing_block_for_absolute_descendants(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue