Lint layout_2013 with clippy (#31221)

* Lint layout_2013 with clippy

CARGO_BUILD_RUSTC=rustc cargo clippy --fix -p layout_2013 --broken-code

* ./mach fmt

* Cosmetic adjustments
This commit is contained in:
Oriol Brufau 2024-01-30 12:46:35 +01:00 committed by GitHub
parent 16cabcf736
commit f7ead9bcb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 490 additions and 483 deletions

View file

@ -742,6 +742,12 @@ impl AbsoluteDescendants {
}
}
impl Default for AbsoluteDescendants {
fn default() -> Self {
Self::new()
}
}
/// Information about each absolutely-positioned descendant of the given flow.
#[derive(Clone)]
pub struct AbsoluteDescendantInfo {
@ -826,6 +832,12 @@ impl LateAbsolutePositionInfo {
}
}
impl Default for LateAbsolutePositionInfo {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Copy, Debug)]
pub struct FragmentationContext {
pub available_block_size: Au,
@ -944,7 +956,7 @@ impl fmt::Debug for BaseFlow {
"".to_owned()
};
let absolute_descendants_string = if self.abs_descendants.len() > 0 {
let absolute_descendants_string = if !self.abs_descendants.is_empty() {
format!("\nabs-descendents={}", self.abs_descendants.len())
} else {
"".to_owned()
@ -1144,7 +1156,7 @@ impl BaseFlow {
/// Return a new BaseFlow like this one but with the given children list
pub fn clone_with_children(&self, children: FlowList) -> BaseFlow {
BaseFlow {
children: children,
children,
restyle_damage: self.restyle_damage |
ServoRestyleDamage::REPAINT |
ServoRestyleDamage::REFLOW_OUT_OF_FLOW |
@ -1153,7 +1165,7 @@ impl BaseFlow {
floats: self.floats.clone(),
abs_descendants: self.abs_descendants.clone(),
absolute_cb: self.absolute_cb.clone(),
clip: self.clip.clone(),
clip: self.clip,
..*self
}