diff --git a/crates/engine/src/cmd/table_draw.rs b/crates/engine/src/cmd/table_draw.rs index a5102ea7cf..ed43933881 100644 --- a/crates/engine/src/cmd/table_draw.rs +++ b/crates/engine/src/cmd/table_draw.rs @@ -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"); diff --git a/crates/layout/src/tests.rs b/crates/layout/src/tests.rs index b83e5bf3fb..a15f2f672b 100644 --- a/crates/layout/src/tests.rs +++ b/crates/layout/src/tests.rs @@ -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) {