style(parse-pdf): satisfy clippy pedantic in page_image (uninlined_format_args + map_unwrap_or)
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) <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ pub fn extract_dctdecode_page_image(
|
||||
) -> Result<Option<Vec<u8>>> {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user