Skip to content

Commit

Permalink
Use 1-based cell indices consistently for Notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Sep 26, 2023
1 parent 93b5d8a commit 404b53e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/ruff_cli/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,9 @@ pub(crate) fn lint_path(
// mutated it.
let src_notebook = source_kind.as_ipy_notebook().unwrap();
let mut stdout = io::stdout().lock();
for ((idx, src_cell), dest_cell) in src_notebook
.cells()
.iter()
.enumerate()
// Cell indices are 1-based.
for ((idx, src_cell), dest_cell) in (1u32..)
.zip(src_notebook.cells().iter())
.zip(dest_notebook.cells().iter())
{
let (Cell::Code(src_code_cell), Cell::Code(dest_code_cell)) =
Expand Down

0 comments on commit 404b53e

Please sign in to comment.