Skip to content

Commit 610c420

Browse files
committed
style: fix rustfmt and clippy warnings
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
1 parent 9032f47 commit 610c420

6 files changed

Lines changed: 24 additions & 34 deletions

File tree

crates/office2pdf/src/parser/pptx_preset_shape_tests.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,7 @@ fn test_shape_home_plate() {
351351
#[test]
352352
fn test_shape_home_plate_square() {
353353
// Square bounding box: the notch should be at x = 0.5
354-
let shape = make_shape(
355-
0,
356-
0,
357-
1_000_000,
358-
1_000_000,
359-
"homePlate",
360-
None,
361-
None,
362-
None,
363-
);
354+
let shape = make_shape(0, 0, 1_000_000, 1_000_000, "homePlate", None, None, None);
364355
let slide = make_slide_xml(&[shape]);
365356
let data = build_test_pptx(SLIDE_CX, SLIDE_CY, &[slide]);
366357
let parser = PptxParser;

crates/office2pdf/src/parser/pptx_slides.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,7 @@ pub(super) fn parse_slide_xml(
15061506
)
15071507
}
15081508

1509+
#[allow(clippy::too_many_arguments)]
15091510
fn parse_slide_xml_inner(
15101511
xml: &str,
15111512
images: &SlideImageMap,

crates/office2pdf/src/render/typst_gen.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ fn generate_fixed_text_box_block(
10961096
fn generate_fixed_text_paragraph(
10971097
out: &mut String,
10981098
para: &Paragraph,
1099-
no_wrap: bool,
1099+
_no_wrap: bool,
11001100
) -> Result<(), ConvertError> {
11011101
let style: &ParagraphStyle = &para.style;
11021102
let needs_text_scope: bool = common_text_style(&para.runs).is_some();
@@ -1126,7 +1126,7 @@ fn generate_fixed_text_paragraph(
11261126
Some(Alignment::Right) => "right",
11271127
_ => "left",
11281128
};
1129-
let _ = write!(out, "#block(width: 100%)[#set align({align_str})\n");
1129+
let _ = writeln!(out, "#block(width: 100%)[#set align({align_str})");
11301130
}
11311131

11321132
generate_runs_with_tabs(out, &para.runs, style.tab_stops.as_deref());

crates/office2pdf/src/render/typst_gen_fixed_page_textbox_tests.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn test_fixed_page_text_box_multiple_paragraphs_preserve_breaks() {
9696
opacity: None,
9797
stroke: None,
9898
shape_kind: None,
99-
no_wrap: false,
99+
no_wrap: false,
100100
}),
101101
}],
102102
)]);
@@ -178,7 +178,7 @@ fn test_fixed_page_text_box_ordered_list_preserves_textbox_styling() {
178178
opacity: None,
179179
stroke: None,
180180
shape_kind: None,
181-
no_wrap: false,
181+
no_wrap: false,
182182
}),
183183
}],
184184
)]);
@@ -465,7 +465,7 @@ fn test_fixed_page_text_box_compact_bulleted_list_uses_custom_marker_style() {
465465
opacity: None,
466466
stroke: None,
467467
shape_kind: None,
468-
no_wrap: false,
468+
no_wrap: false,
469469
}),
470470
}],
471471
)]);
@@ -562,7 +562,7 @@ fn test_fixed_page_text_box_dash_bullets_use_generic_list_path() {
562562
opacity: None,
563563
stroke: None,
564564
shape_kind: None,
565-
no_wrap: false,
565+
no_wrap: false,
566566
}),
567567
}],
568568
)]);
@@ -620,7 +620,7 @@ fn test_fixed_page_text_box_compact_list_preserves_soft_line_breaks() {
620620
opacity: None,
621621
stroke: None,
622622
shape_kind: None,
623-
no_wrap: false,
623+
no_wrap: false,
624624
}),
625625
}],
626626
)]);
@@ -673,7 +673,7 @@ fn test_fixed_page_text_box_with_solid_fill() {
673673
opacity: None,
674674
stroke: None,
675675
shape_kind: None,
676-
no_wrap: false,
676+
no_wrap: false,
677677
}),
678678
}],
679679
)]);
@@ -719,7 +719,7 @@ fn test_fixed_page_text_box_with_fill_and_stroke() {
719719
style: BorderLineStyle::Solid,
720720
}),
721721
shape_kind: None,
722-
no_wrap: false,
722+
no_wrap: false,
723723
}),
724724
}],
725725
)]);
@@ -766,7 +766,7 @@ fn test_fixed_page_text_box_with_fill_and_opacity() {
766766
opacity: Some(0.5),
767767
stroke: None,
768768
shape_kind: None,
769-
no_wrap: false,
769+
no_wrap: false,
770770
}),
771771
}],
772772
)]);
@@ -805,17 +805,15 @@ fn test_fixed_page_text_box_with_polygon_shape_kind() {
805805
left: 7.2,
806806
},
807807
vertical_align: crate::ir::TextBoxVerticalAlign::Center,
808-
fill: Some(Color { r: 0, g: 37, b: 154 }),
808+
fill: Some(Color {
809+
r: 0,
810+
g: 37,
811+
b: 154,
812+
}),
809813
opacity: None,
810814
stroke: None,
811815
shape_kind: Some(ShapeKind::Polygon {
812-
vertices: vec![
813-
(0.0, 0.0),
814-
(0.85, 0.0),
815-
(1.0, 0.5),
816-
(0.85, 1.0),
817-
(0.0, 1.0),
818-
],
816+
vertices: vec![(0.0, 0.0), (0.85, 0.0), (1.0, 0.5), (0.85, 1.0), (0.0, 1.0)],
819817
}),
820818
no_wrap: false,
821819
}),

crates/office2pdf/src/render/typst_gen_shapes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ pub(super) fn write_text_box_shape_background(
446446
write_fill_color(out, c, opacity);
447447
}
448448
write_shape_stroke(out, stroke);
449-
out.push_str(")");
449+
out.push(')');
450450
}
451451
ShapeKind::Polygon { vertices } => {
452452
out.push_str("#polygon(");
@@ -455,7 +455,7 @@ pub(super) fn write_text_box_shape_background(
455455
write_fill_color(out, c, opacity);
456456
}
457457
write_shape_stroke(out, stroke);
458-
out.push_str(")");
458+
out.push(')');
459459
}
460460
ShapeKind::Ellipse => {
461461
let _ = write!(
@@ -468,7 +468,7 @@ pub(super) fn write_text_box_shape_background(
468468
write_fill_color(out, c, opacity);
469469
}
470470
write_shape_stroke(out, stroke);
471-
out.push_str(")");
471+
out.push(')');
472472
}
473473
// Rectangle or line/polyline — shouldn't reach here, but handle gracefully.
474474
_ => {
@@ -482,7 +482,7 @@ pub(super) fn write_text_box_shape_background(
482482
write_fill_color(out, c, opacity);
483483
}
484484
write_shape_stroke(out, stroke);
485-
out.push_str(")");
485+
out.push(')');
486486
}
487487
}
488488
out.push_str("]\n");

crates/office2pdf/src/render/typst_gen_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn make_text_box(x: f64, y: f64, w: f64, h: f64, text: &str) -> FixedElement {
8484
opacity: None,
8585
stroke: None,
8686
shape_kind: None,
87-
no_wrap: false,
87+
no_wrap: false,
8888
}),
8989
}
9090
}
@@ -138,7 +138,7 @@ fn make_fixed_text_box(
138138
opacity: None,
139139
stroke: None,
140140
shape_kind: None,
141-
no_wrap: false,
141+
no_wrap: false,
142142
}),
143143
}
144144
}

0 commit comments

Comments
 (0)