mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Add assert messages and print bad argument values in asserts (#5216)
Enabled the `missing_assert_message` lint * [x] I have followed the instructions in the PR template --------- Co-authored-by: Lucas Meurer <lucasmeurer96@gmail.com>
This commit is contained in:
@@ -32,7 +32,10 @@ impl Size {
|
||||
|
||||
/// Relative size relative to all available space. Values must be in range `0.0..=1.0`.
|
||||
pub fn relative(fraction: f32) -> Self {
|
||||
debug_assert!(0.0 <= fraction && fraction <= 1.0);
|
||||
debug_assert!(
|
||||
0.0 <= fraction && fraction <= 1.0,
|
||||
"fraction should be in the range [0, 1], but was {fraction}"
|
||||
);
|
||||
Self::Relative {
|
||||
fraction,
|
||||
range: Rangef::new(0.0, f32::INFINITY),
|
||||
@@ -121,7 +124,10 @@ impl Sizing {
|
||||
.map(|&size| match size {
|
||||
Size::Absolute { initial, .. } => initial,
|
||||
Size::Relative { fraction, range } => {
|
||||
assert!(0.0 <= fraction && fraction <= 1.0);
|
||||
assert!(
|
||||
0.0 <= fraction && fraction <= 1.0,
|
||||
"fraction should be in the range [0, 1], but was {fraction}"
|
||||
);
|
||||
range.clamp(length * fraction)
|
||||
}
|
||||
Size::Remainder { .. } => {
|
||||
|
||||
Reference in New Issue
Block a user