Skip to content

Commit 07de92f

Browse files
committed
fmt: cargo
1 parent 4f327e6 commit 07de92f

7 files changed

Lines changed: 29 additions & 29 deletions

File tree

float-pigment-css/src/ffi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,8 @@ pub unsafe extern "C" fn style_sheet_bincode_version(
10981098
Err(err) => {
10991099
let mut ss = StyleSheet::from_sheet(&sheet::CompiledStyleSheet::new());
11001100
if let StyleSheet::V1(ssv) = &mut ss {
1101-
*ssv.version = format!("Failed to deserialize bincode formatted style sheet: {err}")
1101+
*ssv.version =
1102+
format!("Failed to deserialize bincode formatted style sheet: {err}")
11021103
.into();
11031104
}
11041105
ss

float-pigment-css/src/parser/property_value/calc.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ impl CalcExpr {
3737
match self {
3838
CalcExpr::Angle(angle) => !matches!(angle.as_ref(), Angle::Calc(_)),
3939
CalcExpr::Number(num) => !matches!(num.as_ref(), Number::Calc(_)),
40-
CalcExpr::Length(length) => !matches!(
41-
length,
42-
Length::Expr(_) | Length::Auto | Length::Undefined
43-
),
40+
CalcExpr::Length(length) => {
41+
!matches!(length, Length::Expr(_) | Length::Auto | Length::Undefined)
42+
}
4443
_ => false,
4544
}
4645
}

float-pigment-css/src/typing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl Length {
194194
}
195195

196196
/// Convert to `Box<CalcExpr>`.
197-
///
197+
///
198198
/// If the length is already a `CalcExpr`, it will be returned directly.
199199
/// Otherwise, it will be wrapped into a new `CalcExpr`.
200200
pub fn into_calc_expr(self) -> Box<CalcExpr> {

float-pigment-layout/src/algo/flow.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,12 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
734734
last_baseline_ascent_option =
735735
Some(child_res.last_baseline_ascent + baseline_diff);
736736
if child_node.should_measure(env) {
737-
child.save_all_results(child_node, env, node_inner_size, LayoutAlgorithm::InlineMeasure);
737+
child.save_all_results(
738+
child_node,
739+
env,
740+
node_inner_size,
741+
LayoutAlgorithm::InlineMeasure,
742+
);
738743
} else {
739744
child.update_result_layout_algorithm(|x| match x {
740745
LayoutAlgorithm::Block => LayoutAlgorithm::InlineBlock,

float-pigment-layout/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ pub enum LayoutAlgorithm {
503503
None,
504504

505505
/// Used when the node is an inline node.
506-
///
506+
///
507507
/// `display: inline` does not guarantee this.
508508
/// For example, if the parent node has `display: flex`,
509509
/// this node will not be an inline node.

float-pigment-layout/src/types.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ impl<L: LengthNum> VectorProxy<L> for Vector<L> {
174174
}
175175

176176
/// A length type that can be undefined or auto.
177-
#[derive(Debug, Clone, Copy, PartialEq)]
178-
#[derive(Default)]
177+
#[derive(Debug, Clone, Copy, PartialEq, Default)]
179178
pub enum DefLength<L: LengthNum, T: PartialEq + Clone = i32> {
180179
/// The length is undetermined.
181180
#[default]
@@ -208,7 +207,6 @@ impl<L: LengthNum, T: PartialEq + Display + Clone> Display for DefLength<L, T> {
208207
}
209208
}
210209

211-
212210
impl<L: LengthNum, T: PartialEq + Clone> DefLength<L, T> {
213211
pub(crate) fn resolve<N: LayoutTreeNode<Length = L, LengthCustom = T>>(
214212
&self,
@@ -1036,15 +1034,13 @@ pub(crate) fn size_to_option<L: LengthNum>(size: Size<L>) -> OptionSize<L> {
10361034
}
10371035

10381036
#[allow(missing_docs)]
1039-
#[derive(Debug, Clone, PartialEq)]
1040-
#[derive(Default)]
1037+
#[derive(Debug, Clone, PartialEq, Default)]
10411038
pub enum LayoutGridTemplate<L: LengthNum, T: PartialEq + Clone = i32> {
10421039
#[default]
10431040
None,
10441041
TrackList(Vec<LayoutTrackListItem<L, T>>),
10451042
}
10461043

1047-
10481044
#[allow(missing_docs)]
10491045
#[derive(Debug, Clone, PartialEq)]
10501046
pub enum LayoutTrackListItem<L: LengthNum, T: PartialEq + Clone = i32> {

float-pigment-layout/src/unit.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ impl<T: LayoutTreeNode> LayoutUnit<T> {
150150
let style = node.style();
151151
let mut layout_algorithm = match style.display() {
152152
Display::None => LayoutAlgorithm::None,
153-
Display::Block
154-
| Display::InlineBlock
155-
| Display::Inline => LayoutAlgorithm::Block,
153+
Display::Block | Display::InlineBlock | Display::Inline => LayoutAlgorithm::Block,
156154
Display::Flex | Display::InlineFlex => LayoutAlgorithm::Flex,
157155
Display::Grid | Display::InlineGrid => LayoutAlgorithm::Grid,
158156
Display::FlowRoot => todo!(),
@@ -188,17 +186,15 @@ impl<T: LayoutTreeNode> LayoutUnit<T> {
188186
collapsed_margin: CollapsedBlockMargin::zero(),
189187
}
190188
}
191-
LayoutAlgorithm::Block => {
192-
algo::flow::Flow::compute(
193-
self,
194-
env,
195-
node,
196-
request.clone(),
197-
margin,
198-
border,
199-
padding_border,
200-
)
201-
}
189+
LayoutAlgorithm::Block => algo::flow::Flow::compute(
190+
self,
191+
env,
192+
node,
193+
request.clone(),
194+
margin,
195+
border,
196+
padding_border,
197+
),
202198
LayoutAlgorithm::Flex => algo::flex_box::FlexBox::compute(
203199
self,
204200
env,
@@ -243,7 +239,10 @@ impl<T: LayoutTreeNode> LayoutUnit<T> {
243239
node.size_updated(env, self.result.size, &self.computed_style);
244240
}
245241

246-
pub(crate) fn update_result_layout_algorithm(&mut self, f: impl FnOnce(LayoutAlgorithm) -> LayoutAlgorithm) {
242+
pub(crate) fn update_result_layout_algorithm(
243+
&mut self,
244+
f: impl FnOnce(LayoutAlgorithm) -> LayoutAlgorithm,
245+
) {
247246
self.layout_algorithm = f(self.layout_algorithm);
248247
}
249248

0 commit comments

Comments
 (0)