Skip to content

Commit

Permalink
Remove panic from to_notebook_range
Browse files Browse the repository at this point in the history
  • Loading branch information
snowsignal committed May 21, 2024
1 parent 4ab4eb7 commit 392d333
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions crates/ruff_server/src/edit/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ impl ToRangeExt for TextRange {
// weird edge case here - if the end of the range is where the newline after the cell got added (making it 'out of bounds')
// we need to move it one character back (which should place it at the end of the last line).
match (cell, notebook_index.cell(end.row)) {
// If the start and end of the range are in two different cells, this is a logic error.
// We should never generate text ranges that cross over cells.
(Some(start_cell), Some(end_cell)) if start_cell != end_cell => {
panic!("attempted to create notebook range that crosses cell boundaries")
}
// If the ending offset is not within a cell boundary, this usually means it is in between the cell boundaries -
// in other words, it's pointing to the newline between the cells.
// By subtracting the end position by 1, we get it to point to the end of the cell.
Expand Down

0 comments on commit 392d333

Please sign in to comment.