1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Remove extra_asserts and extra_debug_asserts feature flags (#4478)

Removes `egui_assert` etc and replaces it with normal `debug_assert`
calls.

Previously you could opt-in to more runtime checks using feature flags.
Now these extra runtime checks are always enabled for debug builds.

You are most likely to encounter them if you use negative sizes or NaNs
or other similar bugs.
These usually indicate bugs in user space.
This commit is contained in:
Emil Ernerfeldt
2024-05-10 19:39:08 +02:00
committed by GitHub
parent 155e138998
commit f19f99180e
32 changed files with 90 additions and 182 deletions

View File

@@ -33,7 +33,7 @@ pub fn best_in_range_f64(min: f64, max: f64) -> f64 {
if !max.is_finite() {
return min;
}
crate::emath_assert!(min.is_finite() && max.is_finite());
debug_assert!(min.is_finite() && max.is_finite());
let min_exponent = min.log10();
let max_exponent = max.log10();
@@ -82,7 +82,7 @@ fn is_integer(f: f64) -> bool {
}
fn to_decimal_string(v: f64) -> [i32; NUM_DECIMALS] {
crate::emath_assert!(v < 10.0, "{:?}", v);
debug_assert!(v < 10.0, "{v:?}");
let mut digits = [0; NUM_DECIMALS];
let mut v = v.abs();
for r in &mut digits {
@@ -104,7 +104,7 @@ fn from_decimal_string(s: &[i32]) -> f64 {
/// Find the simplest integer in the range [min, max]
fn simplest_digit_closed_range(min: i32, max: i32) -> i32 {
crate::emath_assert!(1 <= min && min <= max && max <= 9);
debug_assert!(1 <= min && min <= max && max <= 9);
if min <= 5 && 5 <= max {
5
} else {