diff --git a/egui_extras/src/strip.rs b/egui_extras/src/strip.rs index 131c55cb2..cdb44df09 100644 --- a/egui_extras/src/strip.rs +++ b/egui_extras/src/strip.rs @@ -117,6 +117,10 @@ pub struct Strip<'a, 'b> { impl<'a, 'b> Strip<'a, 'b> { fn next_cell_size(&mut self) -> (CellSize, CellSize) { + assert!( + !self.sizes.is_empty(), + "Tried using more strip cells than available." + ); let size = self.sizes[0]; self.sizes = &self.sizes[1..]; @@ -128,21 +132,11 @@ impl<'a, 'b> Strip<'a, 'b> { /// Add empty cell pub fn empty(&mut self) { - assert!( - !self.sizes.is_empty(), - "Tried using more strip cells than available." - ); - let (width, height) = self.next_cell_size(); self.layout.empty(width, height); } fn cell_impl(&mut self, clip: bool, add_contents: impl FnOnce(&mut Ui)) { - assert!( - !self.sizes.is_empty(), - "Tried using more strip cells than available." - ); - let (width, height) = self.next_cell_size(); self.layout.add(width, height, clip, add_contents); } diff --git a/egui_extras/src/table.rs b/egui_extras/src/table.rs index b105a886c..fd151680f 100644 --- a/egui_extras/src/table.rs +++ b/egui_extras/src/table.rs @@ -10,7 +10,6 @@ use crate::{ }; use egui::{Response, Ui}; -use std::cmp; /// Builder for a [`Table`] with (optional) fixed header and scrolling body. /// @@ -226,7 +225,7 @@ impl<'a> TableBody<'a> { let max_height = self.end_y - self.start_y; let count = (max_height / height).ceil() as usize; - let end = cmp::min(start + count, rows); + let end = rows.min(start + count); for idx in start..end { row(