PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
chore: restore formatting and lint gates for preserved edits
FredAppsd08097f286a3
diff --git a/crates/automation/src/dispatch.rs b/crates/automation/src/dispatch.rsindex a3c34048a..6ce2500e0 100644--- a/crates/automation/src/dispatch.rs+++ b/crates/automation/src/dispatch.rs@@ -886,9 +886,9 @@ impl Automation {[start, end] => usize::try_from(*start).ok().zip(usize::try_from(*end).ok()),_ => None,};- let range = bounds.map(|(start, end)| start..end).filter(|r| {- r.start < r.end && r.end <= text.len() && text.is_char_boundary(r.start) && text.is_char_boundary(r.end)- });+ let range = bounds+ .map(|(start, end)| start..end)+ .filter(|r| r.start < r.end && r.end <= text.len() && text.is_char_boundary(r.start) && text.is_char_boundary(r.end));let Some(range) = range else {return Err(ToolError::InvalidArgs(format!("range must be [start, end]: UTF-8 byte offsets of the paragraph's editor_text (from text_paragraphs) with start < end <= {}, on character boundaries",diff --git a/crates/automation/tests/it/automation.rs b/crates/automation/tests/it/automation.rsindex 60d8d58ed..da3d66224 100644--- a/crates/automation/tests/it/automation.rs+++ b/crates/automation/tests/it/automation.rs@@ -3293,7 +3293,8 @@ fn superscript_and_subscript_through_tools() {let dir = workdir("text-script");let mut a = auto(&dir);let doc = ok(&mut a, "doc_open", json!({ "path": "a.pdf" }))["doc"].as_u64().unwrap();- let paragraph = |a: &mut Automation| ok(a, "text_paragraphs", json!({ "doc": doc, "page": 2 }))["paragraphs"][0]["text"].as_str().unwrap().to_string();+ let paragraph =+ |a: &mut Automation| ok(a, "text_paragraphs", json!({ "doc": doc, "page": 2 }))["paragraphs"][0]["text"].as_str().unwrap().to_string();let script = |script: &str, range: Value| json!({ "doc": doc, "page": 2, "paragraph": 1, "script": script, "range": range });// "Page 2": the 2 is byte 5.let r = ok(&mut a, "text_script", script("superscript", json!([5, 6])));diff --git a/crates/ui-egui/tests/it/editing.rs b/crates/ui-egui/tests/it/editing.rsindex 019f4e26f..f197550ad 100644--- a/crates/ui-egui/tests/it/editing.rs+++ b/crates/ui-egui/tests/it/editing.rs@@ -7724,22 +7724,6 @@ fn rotated_image_selection_and_crop() {assert!(h.state().views[0].image_selection.as_ref().is_some_and(|s| s.crop.is_none()), "crop mode ended");}-trait RectExt {- fn width(&self) -> f64;-}--impl RectExt for [f64; 4] {- fn width(&self) -> f64 {- (self[2] - self[0]).abs()- }-}--impl RectExt for egui::Rect {- fn width(&self) -> f64 {- f64::from(self.width())- }-}-#[test]fn test_image_8_handles_render_and_drag() {let mut png = Vec::new();