Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

M7: compile the paragraph fixture on current main (#2517)

ihsan mokhlisse62af4f87cae5
diff --git a/crates/edit/src/images.rs b/crates/edit/src/images.rs
index 5180e7601..f66e7f24e 100644
--- a/crates/edit/src/images.rs
+++ b/crates/edit/src/images.rs
@@ -186,11 +186,9 @@ impl ImageState {
self.path.curve_to(self.point(x1, y1), end, end);
}
}
- b"h" => {
- // ClosePath with no subpath panics by the same contract (#3581).
- if self.path.elements().last().is_some() {
- self.path.close_path();
- }
+ // ClosePath with no subpath panics by the same contract (#3581).
+ b"h" if self.path.elements().last().is_some() => {
+ self.path.close_path();
}
b"re" => {
if let Some([x, y, w, h]) = op.nums::<4>() {
diff --git a/crates/edit/src/text_regions/grouping.rs b/crates/edit/src/text_regions/grouping.rs
index f866daef5..df281eb92 100644
--- a/crates/edit/src/text_regions/grouping.rs
+++ b/crates/edit/src/text_regions/grouping.rs
@@ -235,7 +235,7 @@ fn group_layout(lines: &[TextLine], mixed: bool) -> Vec<TextBlock> {
// A bullet of its own opens a list item (#2564): such a row is a new paragraph, and
// letting it join is what made an edit of the row above delete this item and the ones
// after it.
- if starts_list_item(&row, lines) {
+ if starts_list_item(row, lines) {
return false;
}
let Some(prev_row) = block.rows.last() else { return false };