mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Lint layout_2020 with clippy (#31196)
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
This commit is contained in:
parent
79c98f0850
commit
33127e0e60
2 changed files with 8 additions and 10 deletions
|
@ -160,11 +160,9 @@ impl IndependentFormattingContext {
|
||||||
let content_sizes = &mut non_replaced.content_sizes;
|
let content_sizes = &mut non_replaced.content_sizes;
|
||||||
let contents = &mut non_replaced.contents;
|
let contents = &mut non_replaced.contents;
|
||||||
sizing::outer_inline(style, containing_block_writing_mode, || {
|
sizing::outer_inline(style, containing_block_writing_mode, || {
|
||||||
content_sizes
|
*content_sizes.get_or_insert_with(|| {
|
||||||
.get_or_insert_with(|| {
|
|
||||||
contents.inline_content_sizes(layout_context, style.writing_mode)
|
contents.inline_content_sizes(layout_context, style.writing_mode)
|
||||||
})
|
})
|
||||||
.clone()
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Self::Replaced(replaced) => {
|
Self::Replaced(replaced) => {
|
||||||
|
@ -199,9 +197,9 @@ impl NonReplacedFormattingContext {
|
||||||
pub fn inline_content_sizes(&mut self, layout_context: &LayoutContext) -> ContentSizes {
|
pub fn inline_content_sizes(&mut self, layout_context: &LayoutContext) -> ContentSizes {
|
||||||
let writing_mode = self.style.writing_mode;
|
let writing_mode = self.style.writing_mode;
|
||||||
let contents = &mut self.contents;
|
let contents = &mut self.contents;
|
||||||
self.content_sizes
|
*self
|
||||||
|
.content_sizes
|
||||||
.get_or_insert_with(|| contents.inline_content_sizes(layout_context, writing_mode))
|
.get_or_insert_with(|| contents.inline_content_sizes(layout_context, writing_mode))
|
||||||
.clone()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,13 +174,13 @@ impl<'a> TableLayout<'a> {
|
||||||
.inline
|
.inline
|
||||||
.non_auto()
|
.non_auto()
|
||||||
.and_then(|length_percentage| length_percentage.to_percentage())
|
.and_then(|length_percentage| length_percentage.to_percentage())
|
||||||
.unwrap_or_else(|| Percentage(0.));
|
.unwrap_or(Percentage(0.));
|
||||||
let max_inline_size_percent = cell
|
let max_inline_size_percent = cell
|
||||||
.style
|
.style
|
||||||
.max_box_size(writing_mode)
|
.max_box_size(writing_mode)
|
||||||
.inline
|
.inline
|
||||||
.and_then(|length_percentage| length_percentage.to_percentage())
|
.and_then(|length_percentage| length_percentage.to_percentage())
|
||||||
.unwrap_or_else(|| Percentage(f32::INFINITY));
|
.unwrap_or(Percentage(f32::INFINITY));
|
||||||
let percentage_contribution =
|
let percentage_contribution =
|
||||||
Percentage(inline_size_percent.0.min(max_inline_size_percent.0));
|
Percentage(inline_size_percent.0.min(max_inline_size_percent.0));
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ impl<'a> TableLayout<'a> {
|
||||||
let resolved = self
|
let resolved = self
|
||||||
.assignable_width
|
.assignable_width
|
||||||
.scale_by(column_measure.percentage_width.0);
|
.scale_by(column_measure.percentage_width.0);
|
||||||
let percent_guess = min_content_width.max(resolved.into());
|
let percent_guess = min_content_width.max(resolved);
|
||||||
(percent_guess, percent_guess, percent_guess)
|
(percent_guess, percent_guess, percent_guess)
|
||||||
} else if constrained {
|
} else if constrained {
|
||||||
(min_content_width, max_content_width, max_content_width)
|
(min_content_width, max_content_width, max_content_width)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue