summaryrefslogtreecommitdiff
path: root/src
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
parent8a88f71cb11565c1a78bd57f02a8df17cb2bf7a0 (diff)
Small style changes
Diffstat (limited to 'src')
-rw-r--r--src/export/pdf.rs8
-rw-r--r--src/layout/mod.rs8
-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
-rw-r--r--src/syntax/mod.rs2
13 files changed, 27 insertions, 27 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs
index 7de34905..b9312c0a 100644
--- a/src/export/pdf.rs
+++ b/src/export/pdf.rs
@@ -583,10 +583,10 @@ impl<'a> PageExporter<'a> {
let Transform { sx, ky, kx, sy, tx, ty } = transform;
self.state.transform = self.state.transform.pre_concat(transform);
self.content.transform([
- sx.get() as f32,
- ky.get() as f32,
- kx.get() as f32,
- sy.get() as f32,
+ sx.get() as _,
+ ky.get() as _,
+ kx.get() as _,
+ sy.get() as _,
tx.to_f32(),
ty.to_f32(),
]);
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index a491789a..405e4e83 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -106,7 +106,7 @@ impl PackedNode {
/// Force a size for this node.
pub fn sized(self, sizing: Spec<Option<Linear>>) -> Self {
if sizing.any(Option::is_some) {
- SizedNode { child: self, sizing }.pack()
+ SizedNode { sizing, child: self }.pack()
} else {
self
}
@@ -115,7 +115,7 @@ impl PackedNode {
/// Set alignments for this node.
pub fn aligned(self, aligns: Spec<Option<Align>>) -> Self {
if aligns.any(Option::is_some) {
- AlignNode { child: self, aligns }.pack()
+ AlignNode { aligns, child: self }.pack()
} else {
self
}
@@ -128,7 +128,7 @@ impl PackedNode {
|| !padding.right.is_zero()
|| !padding.bottom.is_zero()
{
- PadNode { child: self, padding }.pack()
+ PadNode { padding, child: self }.pack()
} else {
self
}
@@ -145,7 +145,7 @@ impl PackedNode {
/// Transform this node's contents without affecting layout.
pub fn transformed(self, transform: Transform, origin: Spec<Align>) -> Self {
if !transform.is_identity() {
- TransformNode { child: self, transform, origin }.pack()
+ TransformNode { transform, origin, child: self }.pack()
} else {
self
}
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 {
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index 6f04cdc9..55a43853 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -16,7 +16,7 @@ use crate::geom::{AngularUnit, LengthUnit};
use crate::source::SourceId;
use crate::util::EcoString;
-/// An inner of leaf node in the untyped green tree.
+/// An inner or leaf node in the untyped green tree.
#[derive(Clone, PartialEq)]
pub enum Green {
/// A reference-counted inner node.