Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3591a90
fix(clippy): use fixed-size RGBA array chunks
loong10k Oct 31, 2026
5fde12d
fix(clippy): use fixed-size RGBA array chunks
loong10k Oct 31, 2026
f07ac82
fix(clippy): use fixed-size RGBA array chunks
loong10k Oct 31, 2026
f620eef
style: format fixed-size OCR pixel iteration
loong10k Oct 31, 2026
fedd092
docs: remove redundant explicit Rustdoc link targets
loong10k Oct 31, 2026
e802554
docs: remove redundant explicit Rustdoc link targets
loong10k Oct 31, 2026
62f84ce
ci: pin API snapshot generator to its original Rustdoc era
loong10k Oct 31, 2026
30a9062
ci: inspect compatible security lockfile refresh
loong10k Oct 31, 2026
87bba4d
fix(security): update patched QUIC and TLS dependencies
loong10k Oct 31, 2026
9fba106
ci: remove temporary lockfile refresh inspection
loong10k Oct 31, 2026
826c4f9
ci(security): audit dependency updates on pull requests
loong10k Oct 31, 2026
a6a4f43
docs: resolve capability link explicitly from crate root
loong10k Oct 31, 2026
b9e4165
ci: inspect Tokio advisory and yanked dependency lock updates
loong10k Oct 31, 2026
2345fd1
fix(security): patch Tokio and replace yanked chacha20 lock entries
loong10k Oct 31, 2026
252e712
ci: remove temporary lockfile refresh workflow
loong10k Oct 31, 2026
6ce61df
ci: emit rustdoc source spans for two remaining link diagnostics
loong10k Oct 31, 2026
41927fe
fix(clippy): modernize empty assertions and raster pixel chunks
loong10k Oct 31, 2026
857c7b7
fix(docs): simplify resolved intra-doc links and restore docs gate
loong10k Oct 31, 2026
0773c3f
style: apply rustfmt to raster chunk tests
loong10k Oct 31, 2026
90e2e12
fix(clippy): make reader empty assertions diagnostic
loong10k Oct 31, 2026
94244aa
ci: collect Clippy diagnostics across all workspace targets
loong10k Oct 31, 2026
2da7be9
fix(clippy): update remaining empty assertions across workspace
loong10k Oct 31, 2026
18f195b
ci: verify declared Rust 1.88 MSRV across workspace
loong10k Oct 31, 2026
da66c7b
ci: verify Rust 1.88 for supported default feature set
loong10k Oct 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ permissions:
contents: read

jobs:
msrv:
name: MSRV (Rust 1.88, default features)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Install Rust 1.88
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.88.0

- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: Check workspace targets at MSRV
run: cargo check --workspace --all-targets --locked

- name: Test documentation at MSRV
run: cargo test --workspace --doc --locked

test:
name: Test (${{ matrix.os }} / Rust ${{ matrix.rust }})
strategy:
Expand Down Expand Up @@ -47,7 +67,7 @@ jobs:

- name: Clippy
if: matrix.rust == 'stable'
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
run: cargo clippy --workspace --all-targets --all-features --keep-going -- -D warnings

- name: Doctest
run: cargo test --workspace --doc
Expand Down Expand Up @@ -119,14 +139,18 @@ jobs:
steps:
- uses: actions/checkout@v5

# API snapshots were generated against the August 2026 rustdoc output.
# Newer nightly output changes derived signatures without source changes.
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2026-08-16

- name: Cache cargo
uses: Swatinem/rust-cache@v2

- name: Install cargo-public-api
run: cargo install cargo-public-api
run: cargo install cargo-public-api --version 0.52.0 --locked

- name: Generate current API snapshots
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- cron: "0 0 * * 1" # Every Monday at 00:00 UTC
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/easypdf-core/src/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ mod tests {
fn pdf_table_new() {
let t = PdfTable::new(vec!["A".into(), "B".into()]);
assert_eq!(t.headers.len(), 2);
assert!(t.rows.is_empty());
assert_eq!(t.rows.len(), 0);
}

#[test]
Expand Down Expand Up @@ -280,7 +280,7 @@ mod tests {
#[test]
fn pdf_table_cell_default() {
let cell = PdfTableCell::default();
assert!(cell.content.is_empty());
assert_eq!(cell.content.len(), 0);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/easypdf-core/src/crypto/sign_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn signed_data_detached_builds_and_parses() {
let issuer_der = cert.issuer().as_raw().to_vec();
let serial = cert.raw_serial();
let cms = build_cms_signed_data(&cert_der, &dummy_sig, &issuer_der, serial);
assert!(!cms.is_empty());
assert_ne!(cms.len(), 0);
let parsed = super::cms::parse_cms_signed_data(&cms).expect("parse CMS");
assert_eq!(parsed.certificate_der, cert_der);
assert_eq!(parsed.signature, dummy_sig);
Expand Down Expand Up @@ -185,7 +185,7 @@ fn verify_unsigned_pdf_fails() {
fn sign_empty_content() {
let (c, k) = generate_test_cert_and_key();
let signed = sign_pdf(b"", &PdfSigner::new(c, k)).unwrap();
assert!(!signed.is_empty());
assert_ne!(signed.len(), 0);
assert!(verify_pdf_signature(&signed).unwrap().is_valid);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ mod tests {
#[test]
fn test_pdf_table_cell_default() {
let c = PdfTableCell::default();
assert!(c.content.is_empty());
assert_eq!(c.content.len(), 0);
assert_eq!(c.h_alignment, TextAlignment::Left);
assert_eq!(c.v_alignment, VerticalAlignment::Top);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-core/src/model/list_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod tests {
let item = ListItem::new("Hello");
assert_eq!(item.text(), "Hello");
assert_eq!(item.level(), 0);
assert!(item.children().is_empty());
assert_eq!(item.children().len(), 0);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions crates/easypdf-core/src/model/pdf_page_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ mod tests {
assert_eq!(code.len(), 1);

let tables: Vec<_> = page.blocks_by_type(PdfBlockType::Table).collect();
assert!(tables.is_empty());
assert_eq!(tables.len(), 0);
}

#[test]
Expand All @@ -213,7 +213,7 @@ mod tests {
#[test]
fn empty_page_blocks() {
let page = PdfPageModel::new(PageIndex::new(0));
assert!(page.blocks().is_empty());
assert_eq!(page.blocks().len(), 0);
assert!(page.iter().next().is_none());
}

Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/markdown_export_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mod tests {
assert_eq!(report.pages_read(), 0);
assert_eq!(report.blocks_written(), 0);
assert_eq!(report.bytes_written(), 0);
assert!(report.warnings().is_empty());
assert_eq!(report.warnings().len(), 0);
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// PDF 到 Markdown 语义处理器能够提供的增强能力。
///
/// 使用布尔值表示是否支持某项能力。对于更细粒度的等级描述,
/// 请使用 [`DetailedProcessorCapabilities`](crate::DetailedProcessorCapabilities)。
/// 请使用 [`crate::DetailedProcessorCapabilities`]。
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[allow(clippy::struct_excessive_bools)]
pub struct MarkdownProcessorCapabilities {
Expand Down
6 changes: 3 additions & 3 deletions crates/easypdf-markdown/src/markdown_renderer/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn new_creates_renderer() {
let renderer = MarkdownRenderer::new(MarkdownProfile::Gfm);
let doc = PdfDocumentModel::default();
let output = renderer.render(&doc);
assert!(output.is_empty());
assert_eq!(output.len(), 0);
}

#[test]
Expand Down Expand Up @@ -430,7 +430,7 @@ fn render_empty_doc() {
let renderer = MarkdownRenderer::new(MarkdownProfile::Gfm);
let doc = PdfDocumentModel::default();
let output = renderer.render(&doc);
assert!(output.is_empty());
assert_eq!(output.len(), 0);
}

// --- Additional coverage tests ---
Expand Down Expand Up @@ -663,7 +663,7 @@ fn render_unknown_block_none() {
let doc = PdfDocumentModel::new(PdfMetadata::default(), vec![page]);
let output = renderer.render(&doc);
// Unknown block produces no output; Plain profile has no page markers
assert!(output.is_empty());
assert_eq!(output.len(), 0);
}

#[test]
Expand Down
4 changes: 3 additions & 1 deletion crates/easypdf-markdown/src/ocr/engines/ocrs_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ impl OcrEngine for OcrsEngine {
// 将 RGBA 像素转换为 RGB(HWC 排列)供 ocrs 使用。
let rgb_pixels: Vec<u8> = image
.pixels
.chunks_exact(4)
.as_chunks::<4>()
.0
.iter()
.flat_map(|rgba| &rgba[..3])
.copied()
.collect();
Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/ocr/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! `easypdf-markdown` 的 OCR 处理器:扫描件 PDF 文本提取。
//!
//! 本模块提供 [`OcrProcessor`],它实现了
//! [`PdfMarkdownProcessor`](crate::PdfMarkdownProcessor),通过 OCR 从
//! [`PdfMarkdownProcessor`],通过 OCR 从
//! 图片密集型或扫描件 PDF 页面中提取文本。它被设计为 Markdown 处理器管道中
//! 的最后回退手段。
//!
Expand Down
6 changes: 3 additions & 3 deletions crates/easypdf-markdown/src/ocr/processor/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn mock_engine_ocr_injects_text_on_empty_page() {
let input = PdfInput::from_bytes(vec![]);

let (result, warnings) = proc.process(&input, doc).unwrap();
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
assert_eq!(result.total_blocks(), 1);

let blocks: Vec<_> = result.iter_all_blocks().collect();
Expand Down Expand Up @@ -311,7 +311,7 @@ fn processes_multiple_pages() {
let input = PdfInput::from_bytes(vec![]);

let (result, warnings) = proc.process(&input, doc).unwrap();
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
assert_eq!(result.page_count(), 3);
// Page 0: 1 block (paragraph)
assert_eq!(result.pages()[0].blocks().len(), 1);
Expand Down Expand Up @@ -502,5 +502,5 @@ fn ocr_with_no_confidence() {
// MockOcrEngine::with_text returns confidence = None by default
assert_eq!(result.total_blocks(), 1);
// No confidence warning because confidence is None
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
}
4 changes: 2 additions & 2 deletions crates/easypdf-markdown/src/processor_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ mod tests {
let doc = empty_doc();
let (result, warnings) = pipeline.run(&empty_input(), doc).unwrap();
assert!(result.is_empty());
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
}

#[test]
Expand Down Expand Up @@ -388,7 +388,7 @@ mod tests {
// Last processor wins since AppendProcessor replaces doc
let blocks: Vec<_> = result.iter_all_blocks().collect();
assert_eq!(blocks.len(), 1);
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/processors/link_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod tests {
));
let doc = PdfDocumentModel::new(PdfMetadata::default(), vec![page]);
let (result, warnings) = proc.process(&PdfInput::from_bytes(vec![]), doc).unwrap();
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
let blocks: Vec<_> = result.iter_all_blocks().collect();
// Should have: paragraph "Visit", link "https://example.com", paragraph "for more"
assert!(blocks.len() >= 2);
Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/processors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! - `LinkExtractorProcessor`:超链接提取
//! - `HeadingDetectorProcessor`:标题检测
//!
//! 这些处理器可在 [`ProcessorPipeline`](crate::ProcessorPipeline) 中
//! 这些处理器可在 [`ProcessorPipeline`] 中
//! 与自定义处理器组合使用。

mod heading_detector;
Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/processors/reading_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ mod tests {
.with_block(PdfBlock::paragraph("Body", loc));
let doc = PdfDocumentModel::new(PdfMetadata::default(), vec![page]);
let (result, warnings) = proc.process(&PdfInput::from_bytes(vec![]), doc).unwrap();
assert!(warnings.is_empty());
assert_eq!(warnings.len(), 0);
assert_eq!(result.total_blocks(), 2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl PdfRenderer for PdfiumRenderer {
let raw = bitmap.as_raw_bytes();
// pdfium 产生 BGRA;转换为 RGBA。
let mut rgba = Vec::with_capacity(raw.len());
for chunk in raw.chunks_exact(4) {
for chunk in raw.as_chunks::<4>().0 {
rgba.push(chunk[2]); // R
rgba.push(chunk[1]); // G
rgba.push(chunk[0]); // B
Expand Down
14 changes: 11 additions & 3 deletions crates/easypdf-markdown/src/render/backends/text_backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ mod tests {
// Count non-white pixels.
let non_white = img
.pixels
.chunks_exact(4)
.filter(|px| px != &[255, 255, 255, 255])
.as_chunks::<4>()
.0
.iter()
.filter(|px| **px != [255, 255, 255, 255])
.count();
// There should be at least some non-white pixels from the text or margins.
// (The text content might be empty if lopdf can't extract it, so we just
Expand Down Expand Up @@ -355,7 +357,13 @@ mod tests {
let pixels = TextRenderer::render_text_to_pixels("", 100, 100, 72, Background::White);
assert_eq!(pixels.len(), 100 * 100 * 4);
// All white
assert!(pixels.chunks_exact(4).all(|px| px == [255, 255, 255, 255]));
assert!(
pixels
.as_chunks::<4>()
.0
.iter()
.all(|px| *px == [255, 255, 255, 255])
);
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl TextRenderer {
let mut pixels = vec![0u8; usize::try_from(width * height * 4).unwrap_or(0)];

// 填充背景。
for chunk in pixels.chunks_exact_mut(4) {
for chunk in pixels.as_chunks_mut::<4>().0 {
chunk.copy_from_slice(&bg_color);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/easypdf-markdown/src/render/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mod tests {
let pixels = vec![255u8; 4 * 2 * 2];
let img = RenderedImage::new(2, 2, ImageFormat::Png, pixels, 0);
let png = img.to_png_bytes().unwrap();
assert!(!png.is_empty());
assert_ne!(png.len(), 0);
// PNG 魔术字节
assert_eq!(&png[..4], &[0x89, 0x50, 0x4E, 0x47]);
}
Expand Down
Loading
Loading