M2.1: Fix remaining Rust 1.100 Clippy lints (#6433)

Replace indexed row/cell loops with mutable iterators in the layout table
tests and the table eraser test. Test-only; no behaviour change.
This commit is contained in:
batistalucasv committed 2026-11-12 15:57:34 -03:00
1 parent a45e37b90d
commit 48d9c2a46c
2 files changed
+7 -7

No files matched your search

+3 -3
View File
@@ -765,9 +765,9 @@ mod tests {
s.run("table.eraser", &json!({"page": 0, "x": a.right() + 0.5, "y": a.y + a.h / 2.0})).unwrap();
let t = first_table(&s);
assert_eq!(shape(&t), shape(&start), "no merge");
for r in 0..2 {
let right = t.rows[r].cells[0].props.borders.and_then(|b| b.right);
let left = t.rows[r].cells[1].props.borders.and_then(|b| b.left);
for (r, row) in t.rows.iter().take(2).enumerate() {
let right = row.cells[0].props.borders.and_then(|b| b.right);
let left = row.cells[1].props.borders.and_then(|b| b.left);
assert!(right.is_some_and(|b| !b.is_visible()) && left.is_some_and(|b| !b.is_visible()), "row {r}");
}
assert!(t.rows[2].cells[0].props.borders.is_none(), "rows outside the edge are untouched");
+4 -4
View File
@@ -8640,8 +8640,8 @@ fn picture_row(room: f32, min: f32, pic_h: f32, lines: usize) -> (DocLayout, Vec
t.rows[1].props.height = Some(min);
t.rows[1].props.height_rule = HeightRule::AtLeast;
}
for c in 1..3 {
t.rows[1].cells[c].blocks = lines_in_cell(lines, "N/A");
for cell in &mut t.rows[1].cells[1..3] {
cell.blocks = lines_in_cell(lines, "N/A");
}
set_at_least_row_spacing(&mut t);
let mut p = wordcraft_doc::Paragraph::with_text("", Default::default());
@@ -10327,8 +10327,8 @@ fn a_hidden_cell_mark_takes_no_room() {
let mut d = Document::from_text("Above");
let mut t = Table::new(3, 2, 300.0);
for (r, text) in [(0, "R1"), (2, "R3")] {
for c in 0..2 {
t.rows[r].cells[c].blocks = vec![wordcraft_doc::para_block(wordcraft_doc::Paragraph::with_text(text, Default::default()))];
for cell in &mut t.rows[r].cells {
cell.blocks = vec![wordcraft_doc::para_block(wordcraft_doc::Paragraph::with_text(text, Default::default()))];
}
}
for (cell, hide) in t.rows[1].cells.iter_mut().zip(hide) {