@@ -203,16 +203,6 @@ impl Buffer {
203203 /// # Panics
204204 ///
205205 /// Panics when given an coordinate that is outside of this Buffer's area.
206− ///
207− /// ```should_panic
208− /// # use helix_tui::buffer::Buffer;
209− /// # use helix_tui::layout::Rect;
210− /// let rect = Rect::new(200, 100, 10, 10);
211− /// let buffer = Buffer::empty(rect);
212− /// // Top coordinate is outside of the buffer in global coordinate space, as the Buffer's area
213− /// // starts at (200, 100).
214− /// buffer.index_of(0, 0); // Panics
215− /// ```
216206 pub fn index_of(&self, x: u16, y: u16) -> usize {
217207 debug_assert!(
218208 x >= self.area.left()
@@ -245,15 +235,6 @@ impl Buffer {
245235 /// # Panics
246236 ///
247237 /// Panics when given an index that is outside the Buffer's content.
248− ///
249− /// ```should_panic
250− /// # use helix_tui::buffer::Buffer;
251− /// # use helix_tui::layout::Rect;
252− /// let rect = Rect::new(0, 0, 10, 10); // 100 cells in total
253− /// let buffer = Buffer::empty(rect);
254− /// // Index 100 is the 101th cell, which lies outside of the area of this Buffer.
255− /// buffer.pos_of(100); // Panics
256− /// ```
257238 pub fn pos_of(&self, i: usize) -> (u16, u16) {
258239 debug_assert!(
259240 i < self.content.len(),
@@ -510,6 +491,7 @@ mod tests {
510491
511492 #[test]
512493 #[should_panic(expected = "outside the buffer")]
494+ #[cfg(debug_assertions)]
513495 fn pos_of_panics_on_out_of_bounds() {
514496 let rect = Rect::new(0, 0, 10, 10);
515497 let buf = Buffer::empty(rect);
@@ -520,6 +502,7 @@ mod tests {
520502
521503 #[test]
522504 #[should_panic(expected = "outside the buffer")]
505+ #[cfg(debug_assertions)]
523506 fn index_of_panics_on_out_of_bounds() {
524507 let rect = Rect::new(0, 0, 10, 10);
525508 let buf = Buffer::empty(rect);