summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-24 17:00:10 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-24 17:00:10 +0100
commit304d9dd1107504f3925c2593dd279ea6616defab (patch)
tree1af3bd9c68659d1a644e40a50a31e6688267400a /src/library
parent8a88f71cb11565c1a78bd57f02a8df17cb2bf7a0 (diff)
Small style changes
Diffstat (limited to 'src/library')
-rw-r--r--src/library/align.rs4
-rw-r--r--src/library/flow.rs2
-rw-r--r--src/library/grid.rs8
-rw-r--r--src/library/image.rs2
-rw-r--r--src/library/pad.rs4
-rw-r--r--src/library/page.rs4
-rw-r--r--src/library/sized.rs4
-rw-r--r--src/library/stack.rs2
-rw-r--r--src/library/text.rs2
-rw-r--r--src/library/transform.rs4
10 files changed, 18 insertions, 18 deletions
diff --git a/src/library/align.rs b/src/library/align.rs
index fa4d17c5..f788b325 100644
--- a/src/library/align.rs
+++ b/src/library/align.rs
@@ -17,10 +17,10 @@ pub fn align(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
/// A node that aligns its child.
#[derive(Debug, Hash)]
pub struct AlignNode {
- /// The node to be aligned.
- pub child: PackedNode,
/// How to align the node horizontally and vertically.
pub aligns: Spec<Option<Align>>,
+ /// The node to be aligned.
+ pub child: PackedNode,
}
impl Layout for AlignNode {
diff --git a/src/library/flow.rs b/src/library/flow.rs
index 93dcbea6..44ce6304 100644
--- a/src/library/flow.rs
+++ b/src/library/flow.rs
@@ -68,7 +68,7 @@ pub enum FlowChild {
impl Debug for FlowChild {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
- Self::Spacing(v) => write!(f, "Spacing({:?})", v),
+ Self::Spacing(spacing) => spacing.fmt(f),
Self::Node(node) => node.fmt(f),
}
}
diff --git a/src/library/grid.rs b/src/library/grid.rs
index 6bd72388..b48856eb 100644
--- a/src/library/grid.rs
+++ b/src/library/grid.rs
@@ -490,19 +490,19 @@ impl<'a> GridLayouter<'a> {
fn layout_multi_row(
&self,
ctx: &mut LayoutContext,
- resolved: &[Length],
+ heights: &[Length],
y: usize,
) -> Vec<Frame> {
// Prepare frames.
- let mut outputs: Vec<_> = resolved
+ let mut outputs: Vec<_> = heights
.iter()
.map(|&h| Frame::new(Size::new(self.used.w, h), h))
.collect();
// Prepare regions.
- let size = Size::new(self.used.w, resolved[0]);
+ let size = Size::new(self.used.w, heights[0]);
let mut pod = Regions::one(size, self.regions.base, Spec::splat(true));
- pod.backlog = resolved[1 ..]
+ pod.backlog = heights[1 ..]
.iter()
.map(|&h| Size::new(self.used.w, h))
.collect::<Vec<_>>()
diff --git a/src/library/image.rs b/src/library/image.rs
index 17822619..a421af60 100644
--- a/src/library/image.rs
+++ b/src/library/image.rs
@@ -73,7 +73,7 @@ impl Layout for ImageNode {
ImageFit::Stretch => canvas,
};
- // The position of the image so that it is centered in the canvas.
+ // Position the image so that it is centered in the canvas.
let mut frame = Frame::new(canvas, canvas.h);
frame.push(
(canvas - size).to_point() / 2.0,
diff --git a/src/library/pad.rs b/src/library/pad.rs
index 829272cc..7604af40 100644
--- a/src/library/pad.rs
+++ b/src/library/pad.rs
@@ -23,10 +23,10 @@ pub fn pad(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
/// A node that adds padding to its child.
#[derive(Debug, Hash)]
pub struct PadNode {
- /// The child node whose sides to pad.
- pub child: PackedNode,
/// The amount of padding.
pub padding: Sides<Linear>,
+ /// The child node whose sides to pad.
+ pub child: PackedNode,
}
impl Layout for PadNode {
diff --git a/src/library/page.rs b/src/library/page.rs
index b256a521..1ac21fac 100644
--- a/src/library/page.rs
+++ b/src/library/page.rs
@@ -82,12 +82,12 @@ pub fn pagebreak(_: &mut EvalContext, _: &mut Args) -> TypResult<Value> {
/// Layouts its children onto one or multiple pages.
#[derive(Debug, Hash)]
pub struct PageNode {
- /// The node that produces the actual pages.
- pub child: PackedNode,
/// The size of the page.
pub size: Size,
/// The background fill.
pub fill: Option<Paint>,
+ /// The node that produces the actual pages.
+ pub child: PackedNode,
}
impl PageNode {
diff --git a/src/library/sized.rs b/src/library/sized.rs
index d137c51e..3e27ff2f 100644
--- a/src/library/sized.rs
+++ b/src/library/sized.rs
@@ -23,10 +23,10 @@ pub fn block(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
/// A node that sizes its child.
#[derive(Debug, Hash)]
pub struct SizedNode {
- /// The node to be sized.
- pub child: PackedNode,
/// How to size the node horizontally and vertically.
pub sizing: Spec<Option<Linear>>,
+ /// The node to be sized.
+ pub child: PackedNode,
}
impl Layout for SizedNode {
diff --git a/src/library/stack.rs b/src/library/stack.rs
index a2e80ba5..d0d5225e 100644
--- a/src/library/stack.rs
+++ b/src/library/stack.rs
@@ -82,7 +82,7 @@ pub enum StackChild {
impl Debug for StackChild {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self {
- Self::Spacing(v) => write!(f, "Spacing({:?})", v),
+ Self::Spacing(spacing) => spacing.fmt(f),
Self::Node(node) => node.fmt(f),
}
}
diff --git a/src/library/text.rs b/src/library/text.rs
index c0ee80e1..f1cd2b4d 100644
--- a/src/library/text.rs
+++ b/src/library/text.rs
@@ -165,7 +165,7 @@ pub fn font(ctx: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
let tracking = args.named("tracking")?.map(Em::new);
let top_edge = args.named("top-edge")?;
let bottom_edge = args.named("bottom-edge")?;
- let fill = args.named("fill")?.or_else(|| args.find()).map(Paint::Solid);
+ let fill = args.named("fill")?.or_else(|| args.find());
let kerning = args.named("kerning")?;
let smallcaps = args.named("smallcaps")?;
let alternates = args.named("alternates")?;
diff --git a/src/library/transform.rs b/src/library/transform.rs
index 8d1c6132..75df8067 100644
--- a/src/library/transform.rs
+++ b/src/library/transform.rs
@@ -40,12 +40,12 @@ fn transform_impl(args: &mut Args, transform: Transform) -> TypResult<Value> {
/// A node that transforms its child without affecting layout.
#[derive(Debug, Hash)]
pub struct TransformNode {
- /// The node whose contents should be transformed.
- pub child: PackedNode,
/// Transformation to apply to the contents.
pub transform: Transform,
/// The origin of the transformation.
pub origin: Spec<Align>,
+ /// The node whose contents should be transformed.
+ pub child: PackedNode,
}
impl Layout for TransformNode {