aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/flex.rs
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-01-30 12:46:35 +0100
committerGitHub <noreply@github.com>2024-01-30 11:46:35 +0000
commitf7ead9bcb6fca650b797a9ac53a2de13c882d86c (patch)
tree0dce7dc5b1e64238b97658c9738f935e74c2308f /components/layout/flex.rs
parent16cabcf7368538dafd6c59eb37a2fa651ac8ff1b (diff)
downloadservo-f7ead9bcb6fca650b797a9ac53a2de13c882d86c.tar.gz
servo-f7ead9bcb6fca650b797a9ac53a2de13c882d86c.zip
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
Diffstat (limited to 'components/layout/flex.rs')
-rw-r--r--components/layout/flex.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index a8265e0c2d2..56bf6ca7c6a 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -120,10 +120,10 @@ impl FlexItem {
base_size: Au(0),
min_size: Au(0),
max_size: MAX_AU,
- index: index,
+ index,
flex_grow: flex_grow.into(),
flex_shrink: flex_shrink.into(),
- order: order,
+ order,
is_frozen: false,
is_strut: false,
}
@@ -202,7 +202,7 @@ impl FlexItem {
/// Returns the outer main size of the item, including paddings and margins,
/// clamped by max and min size.
pub fn outer_main_size(&self, flow: &dyn Flow, direction: Direction) -> Au {
- let ref fragment = flow.as_block().fragment;
+ let fragment = &flow.as_block().fragment;
let outer_width = match direction {
Direction::Inline => {
fragment.border_padding.inline_start_end() + fragment.margin.inline_start_end()
@@ -259,9 +259,9 @@ struct FlexLine {
impl FlexLine {
pub fn new(range: Range<usize>, free_space: Au, auto_margin_count: i32) -> FlexLine {
FlexLine {
- range: range,
- auto_margin_count: auto_margin_count,
- free_space: free_space,
+ range,
+ auto_margin_count,
+ free_space,
cross_size: Au(0),
}
}
@@ -399,14 +399,14 @@ impl FlexFlow {
FlexFlow {
block_flow: BlockFlow::from_fragment_and_float_kind(fragment, flotation),
- main_mode: main_mode,
+ main_mode,
available_main_size: AxisSize::Infinite,
available_cross_size: AxisSize::Infinite,
lines: Vec::new(),
items: Vec::new(),
- main_reverse: main_reverse,
- is_wrappable: is_wrappable,
- cross_reverse: cross_reverse,
+ main_reverse,
+ is_wrappable,
+ cross_reverse,
}
}
@@ -709,9 +709,9 @@ impl FlexFlow {
let base = children.get(item.index).mut_base();
if !self.main_reverse {
base.position.start.b = cur_b;
- cur_b = cur_b + base.position.size.block;
+ cur_b += base.position.size.block;
} else {
- cur_b = cur_b - base.position.size.block;
+ cur_b -= base.position.size.block;
base.position.start.b = cur_b;
}
}