diff --git a/crates/office2pdf/src/parser/docx_sections.rs b/crates/office2pdf/src/parser/docx_sections.rs index 3af19df..da50287 100644 --- a/crates/office2pdf/src/parser/docx_sections.rs +++ b/crates/office2pdf/src/parser/docx_sections.rs @@ -395,15 +395,13 @@ fn extract_hf_run_elements( })); } } - docx_rs::RunChild::Tab(_) => { - if !in_field { - elements.push(HFInline::Run(Run { - text: "\t".to_string(), - style: style.clone(), - href: None, - footnote: None, - })); - } + docx_rs::RunChild::Tab(_) if !in_field => { + elements.push(HFInline::Run(Run { + text: "\t".to_string(), + style: style.clone(), + href: None, + footnote: None, + })); } _ => {} } diff --git a/crates/office2pdf/src/parser/docx_tables.rs b/crates/office2pdf/src/parser/docx_tables.rs index a6514b7..a55ee6e 100644 --- a/crates/office2pdf/src/parser/docx_tables.rs +++ b/crates/office2pdf/src/parser/docx_tables.rs @@ -366,17 +366,15 @@ fn extract_cell_content( docx_rs::TableCellContent::Paragraph(para) => { convert_paragraph_blocks(para, &mut blocks, images, hyperlinks, style_map, ctx); } - docx_rs::TableCellContent::Table(nested_table) => { - if depth < MAX_TABLE_DEPTH { - blocks.push(Block::Table(convert_table( - nested_table, - images, - hyperlinks, - style_map, - ctx, - depth + 1, - ))); - } + docx_rs::TableCellContent::Table(nested_table) if depth < MAX_TABLE_DEPTH => { + blocks.push(Block::Table(convert_table( + nested_table, + images, + hyperlinks, + style_map, + ctx, + depth + 1, + ))); } _ => {} } diff --git a/crates/office2pdf/src/parser/docx_text.rs b/crates/office2pdf/src/parser/docx_text.rs index fd0e77c..49ec104 100644 --- a/crates/office2pdf/src/parser/docx_text.rs +++ b/crates/office2pdf/src/parser/docx_text.rs @@ -255,10 +255,8 @@ pub(super) fn extract_run_text_skip_column_breaks(run: &docx_rs::Run) -> String match child { docx_rs::RunChild::Text(t) => text.push_str(&t.text), docx_rs::RunChild::Tab(_) => text.push('\t'), - docx_rs::RunChild::Break(br) => { - if !is_column_break(br) { - text.push('\n'); - } + docx_rs::RunChild::Break(br) if !is_column_break(br) => { + text.push('\n'); } _ => {} } diff --git a/crates/office2pdf/src/parser/smartart.rs b/crates/office2pdf/src/parser/smartart.rs index fbeb524..54e254a 100644 --- a/crates/office2pdf/src/parser/smartart.rs +++ b/crates/office2pdf/src/parser/smartart.rs @@ -35,11 +35,9 @@ pub(crate) fn parse_smartart_data_xml(xml: &str) -> Vec { "doc" => { doc_id = Some(pt.model_id.clone()); } - "node" => { - if !pt.text.is_empty() { - node_texts.insert(pt.model_id.clone(), pt.text.clone()); - node_order.push(pt.model_id.clone()); - } + "node" if !pt.text.is_empty() => { + node_texts.insert(pt.model_id.clone(), pt.text.clone()); + node_order.push(pt.model_id.clone()); } _ => {} }