mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add features extra_asserts and extra_debug_asserts for more asserts
This replaces all debug_asserts with these opt-in asserts Related: https://github.com/emilk/egui/issues/395
This commit is contained in:
@@ -33,7 +33,7 @@ pub fn best_in_range_f64(min: f64, max: f64) -> f64 {
|
||||
if !max.is_finite() {
|
||||
return min;
|
||||
}
|
||||
debug_assert!(min.is_finite() && max.is_finite());
|
||||
crate::emath_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] {
|
||||
debug_assert!(v < 10.0, "{:?}", v);
|
||||
crate::emath_assert!(v < 10.0, "{:?}", v);
|
||||
let mut digits = [0; NUM_DECIMALS];
|
||||
let mut v = v.abs();
|
||||
for r in digits.iter_mut() {
|
||||
@@ -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 {
|
||||
debug_assert!(1 <= min && min <= max && max <= 9);
|
||||
crate::emath_assert!(1 <= min && min <= max && max <= 9);
|
||||
if min <= 5 && 5 <= max {
|
||||
5
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user