From 8d81bc1071307a4d6fa4e68c6421f89dc5c332e5 Mon Sep 17 00:00:00 2001 From: altair823 Date: Wed, 27 May 2026 06:14:00 +0000 Subject: [PATCH] style(parse-pdf): satisfy clippy pedantic in page_image (uninlined_format_args + map_unwrap_or) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit c2cd3a7 의 `extract_dctdecode_page_image` 에 workspace clippy pedantic 위반 2 건 잔존 → CI gate (cargo clippy --workspace --all-targets -- -D warnings) fail. 두 lint 모두 1-line edit + semantic 동일, logic 변경 0. - L20 uninlined_format_args: format!("page {} not in get_pages()", page_num) → format!("page {page_num} not in get_pages()") - L48-52 map_unwrap_or: .map(|n| n == b"Image").unwrap_or(false) → .is_some_and(|n| n == b"Image") cargo clippy --workspace --all-targets -j 4 -- -D warnings → exit 0. cargo test -p kebab-parse-pdf -j 4 → 21 passed (regression 0). review trail: - spec review: .omc/reviews/2026-05-27-pdf-ocr-step-03-spec-review-result.md (SPEC_COMPLIANT) - code review: .omc/reviews/2026-05-27-pdf-ocr-step-03-code-review-result.md (Critical C-1) Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/kebab-parse-pdf/src/page_image.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/kebab-parse-pdf/src/page_image.rs b/crates/kebab-parse-pdf/src/page_image.rs index a1bce85..900b8e5 100644 --- a/crates/kebab-parse-pdf/src/page_image.rs +++ b/crates/kebab-parse-pdf/src/page_image.rs @@ -17,7 +17,7 @@ pub fn extract_dctdecode_page_image( ) -> Result>> { let pages = pdf_doc.get_pages(); let &page_oid = pages.get(&page_num) - .with_context(|| format!("page {} not in get_pages()", page_num))?; + .with_context(|| format!("page {page_num} not in get_pages()"))?; // page → /Resources → /XObject → traverse for first /Subtype /Image with /Filter == /DCTDecode. let page = pdf_doc.get_dictionary(page_oid)?; @@ -48,8 +48,7 @@ pub fn extract_dctdecode_page_image( let subtype_is_image = stream.dict.get(b"Subtype") .ok() .and_then(|o| match o { Object::Name(n) => Some(n.as_slice()), _ => None }) - .map(|n| n == b"Image") - .unwrap_or(false); + .is_some_and(|n| n == b"Image"); if !subtype_is_image { continue; } let filter_obj = stream.dict.get(b"Filter").ok();