1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

small code cleanup

This commit is contained in:
Emil Ernerfeldt
2022-03-31 21:10:02 +02:00
parent 8718ae6c59
commit 8681ec5cc9
2 changed files with 5 additions and 12 deletions

View File

@@ -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);
}

View File

@@ -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(