mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-12-04 13:03:19 -05:00
M14: fix existing clippy warnings
This commit is contained in:
1 parent
ecdd1e658c
commit
9efe4eceea
6 files changed
+14
-23
No files matched your search
@@ -239,11 +239,9 @@ impl ImageState {
|
||||
self.path.curve_to(p1, end, end);
|
||||
}
|
||||
}
|
||||
b"h" => {
|
||||
// ClosePath with no subpath panics by the same contract (#3581).
|
||||
if self.has_current_point() {
|
||||
self.path.close_path();
|
||||
}
|
||||
// ClosePath with no subpath panics by the same contract (#3581).
|
||||
b"h" if self.has_current_point() => {
|
||||
self.path.close_path();
|
||||
}
|
||||
b"re" => {
|
||||
if let Some([x, y, w, h]) = op.nums::<4>()
|
||||
|
||||
@@ -60,11 +60,8 @@ impl PdfCraftApp {
|
||||
let info = self.session.get(view.id).map(|d| &d.info);
|
||||
match info.and_then(|i| i.open_dest.filter(|(page, _)| *page < pages).map(|d| (i, d))) {
|
||||
Some((info, (page, dest))) if !self.always_default_view => view.go_to_dest(page, dest, info),
|
||||
Some((_, (page, _))) => {
|
||||
if page > 0 {
|
||||
view.go_to_page(page);
|
||||
}
|
||||
}
|
||||
Some((_, (page, _))) if page > 0 => view.go_to_page(page),
|
||||
Some(_) => {}
|
||||
None if v.page > 0 && v.page < pages => view.go_to_page(v.page),
|
||||
None => {}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ fn card(ui: &mut egui::Ui, view: &mut DocView, context: CardContext<'_>) -> Opti
|
||||
let head = ui.horizontal(|ui| {
|
||||
above = avatar(ui, t, Some(subtype_icon(&a.subtype)), None, color);
|
||||
// The catalogue and author names stay logical: egui lays out RTL text itself.
|
||||
let author = a.author.as_deref().map_or_else(|| tl!("Unknown author"), |name| name);
|
||||
let author = a.author.as_deref().unwrap_or_else(|| tl!("Unknown author"));
|
||||
ui.label(egui::RichText::new(author).font(theme::semibold(12.5)).color(t.text));
|
||||
if let Some(m) = &a.modified {
|
||||
ui.add(egui::Label::new(egui::RichText::new(m).font(theme::regular(11.0)).color(t.text_faint)).truncate());
|
||||
@@ -471,7 +471,7 @@ fn card(ui: &mut egui::Ui, view: &mut DocView, context: CardContext<'_>) -> Opti
|
||||
ui.vertical(|ui| {
|
||||
ui.spacing_mut().item_spacing.y = 2.0;
|
||||
ui.horizontal(|ui| {
|
||||
let author = r.author.as_deref().map_or_else(|| tl!("Reply"), |name| name);
|
||||
let author = r.author.as_deref().unwrap_or_else(|| tl!("Reply"));
|
||||
ui.label(egui::RichText::new(author).font(theme::semibold(12.0)));
|
||||
if let Some(m) = &r.modified {
|
||||
ui.add(egui::Label::new(egui::RichText::new(m).font(theme::regular(11.0)).color(t.text_faint)).truncate());
|
||||
|
||||
@@ -267,15 +267,11 @@ impl PdfCraftApp {
|
||||
let ids: Vec<u64> = self.combine_draft.iter().map(|f| f.id).collect();
|
||||
let tab = &mut self.combine_tab;
|
||||
match action {
|
||||
RowAction::Preview(id) => {
|
||||
if ids.contains(&id) {
|
||||
self.combine_tab.preview = Some(Preview { file: id, at: 0, page: None, pages: None });
|
||||
}
|
||||
RowAction::Preview(id) if ids.contains(&id) => {
|
||||
self.combine_tab.preview = Some(Preview { file: id, at: 0, page: None, pages: None });
|
||||
}
|
||||
RowAction::PreviewAt(id, at) => {
|
||||
if ids.contains(&id) {
|
||||
self.combine_tab.preview = Some(Preview { file: id, at, page: None, pages: None });
|
||||
}
|
||||
RowAction::PreviewAt(id, at) if ids.contains(&id) => {
|
||||
self.combine_tab.preview = Some(Preview { file: id, at, page: None, pages: None });
|
||||
}
|
||||
RowAction::Expand(id, on) => {
|
||||
if on {
|
||||
|
||||
@@ -318,7 +318,7 @@ fn shading(s: &CompareState, old: bool) -> Vec<(usize, [f32; 4], Color32)> {
|
||||
for (p, r) in &s.visual {
|
||||
let r = r.map(|v| v as f32);
|
||||
// The old file's half also skips a region overlapping one it already shades.
|
||||
if !overlaps(*p, r, &text) && !(old && overlaps(*p, r, &visual)) {
|
||||
if !(overlaps(*p, r, &text) || old && overlaps(*p, r, &visual)) {
|
||||
visual.push((*p, r, VISUAL));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4797,7 +4797,7 @@ fn image_edge_handle_stretch_and_crop_mode() {
|
||||
// Confirm crop with Enter key
|
||||
h.key_press(egui::Key::Enter);
|
||||
h.run_steps(4);
|
||||
assert!(!h.state().views[0].image_selection.as_ref().is_some_and(|s| s.crop.is_some()));
|
||||
assert!(h.state().views[0].image_selection.as_ref().is_none_or(|s| s.crop.is_none()));
|
||||
let doc_id = h.state().views[0].id;
|
||||
let images = h.state().session.get(doc_id).unwrap().page_images(0);
|
||||
assert_eq!(images.len(), 1, "image still exists: {images:?}");
|
||||
@@ -7490,7 +7490,7 @@ fn added_and_pasted_image_uses_refactored_image_edits() {
|
||||
set_crop_box(&mut h, smaller);
|
||||
h.key_press(egui::Key::Enter);
|
||||
h.run_steps(4);
|
||||
assert!(!h.state().views[0].image_selection.as_ref().is_some_and(|s| s.crop.is_some()), "crop mode exited");
|
||||
assert!(h.state().views[0].image_selection.as_ref().is_none_or(|s| s.crop.is_none()), "crop mode exited");
|
||||
|
||||
let images_after_crop = h.state().session.get(id).unwrap().page_images(0);
|
||||
assert!(images_after_crop[0].visible_rect.is_some());
|
||||
|
||||
Reference in new issue
Block a user