summaryrefslogtreecommitdiff
path: root/src/library/grid.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-12-30 11:37:11 +0100
committerLaurenz <laurmaedje@gmail.com>2021-12-30 12:00:12 +0100
commitf5dcb84e36a38182218c7f907b861b12d2bd2c1c (patch)
tree1fce04fb53d2ad5b61f5f3151e43d80e2684e579 /src/library/grid.rs
parentfef55025177ea4f248e61b68fab365bfbc0e47fb (diff)
Make clippy a bit happier
Diffstat (limited to 'src/library/grid.rs')
-rw-r--r--src/library/grid.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/library/grid.rs b/src/library/grid.rs
index 3292cfe0..cc636afc 100644
--- a/src/library/grid.rs
+++ b/src/library/grid.rs
@@ -15,7 +15,7 @@ pub fn grid(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
column_gutter.unwrap_or_else(|| base_gutter.clone()),
row_gutter.unwrap_or(base_gutter),
),
- children: args.all().map(Node::into_block).collect(),
+ children: args.all().collect(),
}))
}
@@ -87,8 +87,6 @@ castable! {
struct GridLayouter<'a> {
/// The children of the grid.
children: &'a [PackedNode],
- /// Whether the grid should expand to fill the region.
- expand: Spec<bool>,
/// The column tracks including gutter tracks.
cols: Vec<TrackSizing>,
/// The row tracks including gutter tracks.
@@ -97,6 +95,10 @@ struct GridLayouter<'a> {
regions: Regions,
/// Resolved column sizes.
rcols: Vec<Length>,
+ /// Rows in the current region.
+ lrows: Vec<Row>,
+ /// Whether the grid should expand to fill the region.
+ expand: Spec<bool>,
/// The full height of the current region.
full: Length,
/// The used-up size of the current region. The horizontal size is
@@ -104,8 +106,6 @@ struct GridLayouter<'a> {
used: Size,
/// The sum of fractional ratios in the current region.
fr: Fractional,
- /// Rows in the current region.
- lrows: Vec<Row>,
/// Constraints for the active region.
cts: Constraints,
/// Frames for finished regions.
@@ -161,22 +161,26 @@ impl<'a> GridLayouter<'a> {
cols.pop();
rows.pop();
+ let expand = regions.expand;
+ let full = regions.current.y;
+ let rcols = vec![Length::zero(); cols.len()];
+ let lrows = vec![];
+
// We use the regions for auto row measurement. Since at that moment,
// columns are already sized, we can enable horizontal expansion.
- let expand = regions.expand;
regions.expand = Spec::new(true, false);
Self {
children: &grid.children,
- expand,
- rcols: vec![Length::zero(); cols.len()],
cols,
rows,
- full: regions.current.y,
regions,
+ rcols,
+ lrows,
+ expand,
+ full,
used: Size::zero(),
fr: Fractional::zero(),
- lrows: vec![],
cts: Constraints::new(expand),
finished: vec![],
}