mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Lint layout_2020 with clippy (#31169)
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
This commit is contained in:
parent
886f6c58d4
commit
50f56affe3
30 changed files with 224 additions and 244 deletions
|
@ -114,6 +114,6 @@ impl Tag {
|
|||
Some(PseudoElement::After) => FragmentType::AfterPseudoContent,
|
||||
_ => FragmentType::FragmentBody,
|
||||
};
|
||||
combine_id_with_fragment_type(self.node.id() as usize, fragment_type) as u64
|
||||
combine_id_with_fragment_type(self.node.id(), fragment_type) as u64
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,10 +135,7 @@ impl BoxFragment {
|
|||
BoxFragment {
|
||||
base: base_fragment_info.into(),
|
||||
style,
|
||||
children: children
|
||||
.into_iter()
|
||||
.map(|fragment| ArcRefCell::new(fragment))
|
||||
.collect(),
|
||||
children: children.into_iter().map(ArcRefCell::new).collect(),
|
||||
content_rect,
|
||||
padding,
|
||||
border,
|
||||
|
@ -221,7 +218,7 @@ impl BoxFragment {
|
|||
|
||||
// https://www.w3.org/TR/css-overflow-3/#scrollable
|
||||
// Only include the scrollable overflow of a child box if it has overflow: visible.
|
||||
let scrollable_overflow = self.scrollable_overflow(&containing_block);
|
||||
let scrollable_overflow = self.scrollable_overflow(containing_block);
|
||||
let bottom_right = PhysicalPoint::new(
|
||||
overflow.max_x().max(scrollable_overflow.max_x()),
|
||||
overflow.max_y().max(scrollable_overflow.max_y()),
|
||||
|
@ -254,7 +251,7 @@ impl BoxFragment {
|
|||
let (cb_width, cb_height) = (containing_block.width(), containing_block.height());
|
||||
let content_rect = self
|
||||
.content_rect
|
||||
.to_physical(self.style.writing_mode, &containing_block);
|
||||
.to_physical(self.style.writing_mode, containing_block);
|
||||
|
||||
if let Some(resolved_sticky_insets) = self.resolved_sticky_insets {
|
||||
return resolved_sticky_insets;
|
||||
|
|
|
@ -67,11 +67,11 @@ impl<'a, T> ContainingBlockManager<'a, T> {
|
|||
&self,
|
||||
for_non_absolute_descendants: &'a T,
|
||||
) -> Self {
|
||||
return ContainingBlockManager {
|
||||
ContainingBlockManager {
|
||||
for_non_absolute_descendants,
|
||||
for_absolute_descendants: self.for_absolute_descendants,
|
||||
for_absolute_and_fixed_descendants: self.for_absolute_and_fixed_descendants,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_for_absolute_descendants(
|
||||
|
@ -79,11 +79,11 @@ impl<'a, T> ContainingBlockManager<'a, T> {
|
|||
for_non_absolute_descendants: &'a T,
|
||||
for_absolute_descendants: &'a T,
|
||||
) -> Self {
|
||||
return ContainingBlockManager {
|
||||
ContainingBlockManager {
|
||||
for_non_absolute_descendants,
|
||||
for_absolute_descendants: Some(for_absolute_descendants),
|
||||
for_absolute_and_fixed_descendants: self.for_absolute_and_fixed_descendants,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_for_absolute_and_fixed_descendants(
|
||||
|
@ -91,10 +91,10 @@ impl<'a, T> ContainingBlockManager<'a, T> {
|
|||
for_non_absolute_descendants: &'a T,
|
||||
for_absolute_and_fixed_descendants: &'a T,
|
||||
) -> Self {
|
||||
return ContainingBlockManager {
|
||||
ContainingBlockManager {
|
||||
for_non_absolute_descendants,
|
||||
for_absolute_descendants: None,
|
||||
for_absolute_and_fixed_descendants,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ impl Fragment {
|
|||
match self {
|
||||
Fragment::Box(fragment) => fragment.print(tree),
|
||||
Fragment::Float(fragment) => {
|
||||
tree.new_level(format!("Float"));
|
||||
tree.new_level("Float".to_string());
|
||||
fragment.print(tree);
|
||||
tree.end_level();
|
||||
},
|
||||
|
@ -163,19 +163,19 @@ impl Fragment {
|
|||
) -> PhysicalRect<Length> {
|
||||
match self {
|
||||
Fragment::Box(fragment) | Fragment::Float(fragment) => {
|
||||
fragment.scrollable_overflow_for_parent(&containing_block)
|
||||
fragment.scrollable_overflow_for_parent(containing_block)
|
||||
},
|
||||
Fragment::AbsoluteOrFixedPositioned(_) => PhysicalRect::zero(),
|
||||
Fragment::Anonymous(fragment) => fragment.scrollable_overflow.clone(),
|
||||
Fragment::Anonymous(fragment) => fragment.scrollable_overflow,
|
||||
Fragment::Text(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.parent_style.writing_mode, &containing_block),
|
||||
.to_physical(fragment.parent_style.writing_mode, containing_block),
|
||||
Fragment::Image(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.style.writing_mode, &containing_block),
|
||||
.to_physical(fragment.style.writing_mode, containing_block),
|
||||
Fragment::IFrame(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.style.writing_mode, &containing_block),
|
||||
.to_physical(fragment.style.writing_mode, containing_block),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,10 +251,7 @@ impl AnonymousFragment {
|
|||
AnonymousFragment {
|
||||
base: BaseFragment::anonymous(),
|
||||
rect,
|
||||
children: children
|
||||
.into_iter()
|
||||
.map(|fragment| ArcRefCell::new(fragment))
|
||||
.collect(),
|
||||
children: children.into_iter().map(ArcRefCell::new).collect(),
|
||||
mode,
|
||||
scrollable_overflow,
|
||||
}
|
||||
|
|
|
@ -104,10 +104,10 @@ impl FragmentTree {
|
|||
let fragment_relative_rect = match fragment {
|
||||
Fragment::Box(fragment) | Fragment::Float(fragment) => fragment
|
||||
.border_rect()
|
||||
.to_physical(fragment.style.writing_mode, &containing_block),
|
||||
.to_physical(fragment.style.writing_mode, containing_block),
|
||||
Fragment::Text(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.parent_style.writing_mode, &containing_block),
|
||||
.to_physical(fragment.parent_style.writing_mode, containing_block),
|
||||
Fragment::AbsoluteOrFixedPositioned(_) |
|
||||
Fragment::Image(_) |
|
||||
Fragment::IFrame(_) |
|
||||
|
@ -156,7 +156,7 @@ impl FragmentTree {
|
|||
return Some(Rect::zero());
|
||||
}
|
||||
|
||||
let padding_rect = padding_rect.to_physical(style.writing_mode, &containing_block);
|
||||
let padding_rect = padding_rect.to_physical(style.writing_mode, containing_block);
|
||||
let border = style.get_border();
|
||||
Some(Rect::new(
|
||||
Point2D::new(
|
||||
|
@ -187,7 +187,7 @@ impl FragmentTree {
|
|||
let tag_to_find = Tag::new(requested_node);
|
||||
let scroll_area = self.find(|fragment, _, containing_block| {
|
||||
if fragment.tag() == Some(tag_to_find) {
|
||||
Some(fragment.scrolling_area(&containing_block))
|
||||
Some(fragment.scrolling_area(containing_block))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ pub(crate) enum AbsoluteBoxOffsets {
|
|||
impl AbsoluteBoxOffsets {
|
||||
pub(crate) fn both_specified(&self) -> bool {
|
||||
match self {
|
||||
AbsoluteBoxOffsets::Both { .. } => return true,
|
||||
_ => return false,
|
||||
AbsoluteBoxOffsets::Both { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue