Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed Nov 28, 2023
1 parent f920cc4 commit d70d8b8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crates/ruff_notebook/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,7 @@ impl Cell {
}

/// Cell offsets are used to keep track of the start and end offsets of each
/// cell in the concatenated source code.
///
/// These offsets are in sorted order and is enforced by the [`CellOffsets::push`]
/// method.
/// cell in the concatenated source code. These offsets are in sorted order.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CellOffsets(Vec<TextSize>);

Expand All @@ -195,9 +192,10 @@ impl CellOffsets {
/// Panics if the offset is less than the last offset pushed.
pub(crate) fn push(&mut self, offset: TextSize) {
if let Some(last_offset) = self.0.last() {
if *last_offset > offset {
panic!("Offsets must be pushed in sorted order");
}
assert!(
*last_offset <= offset,
"Offsets must be pushed in sorted order"
);
}
self.0.push(offset);
}
Expand Down

0 comments on commit d70d8b8

Please sign in to comment.