Skip to content

Commit f53a9c9

Browse files
committed
Small refactor of debug assert
1 parent ec4313d commit f53a9c9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

crates/egui/src/widget_rect.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,6 @@ impl WidgetRects {
178178
// e.g. calling `response.interact(…)` to add more interaction.
179179
let (idx_in_layer, existing) = entry.get_mut();
180180

181-
debug_assert!(
182-
existing.layer_id == widget_rect.layer_id,
183-
"Widget {:?} changed layer_id during the frame from {:?} to {:?}",
184-
widget_rect.id,
185-
existing.layer_id,
186-
widget_rect.layer_id
187-
);
188-
189181
// Update it:
190182
existing.rect = widget_rect.rect; // last wins
191183
existing.interact_rect = widget_rect.interact_rect; // last wins
@@ -200,6 +192,11 @@ impl WidgetRects {
200192
} else {
201193
layer_widgets[*idx_in_layer] = *existing;
202194
}
195+
} else if cfg!(debug_assertions) {
196+
panic!(
197+
"DEBUG ASSERT: Widget {:?} changed layer_id during the frame from {:?} to {:?}",
198+
widget_rect.id, existing.layer_id, widget_rect.layer_id
199+
);
203200
}
204201
}
205202
}

0 commit comments

Comments
 (0)