Browse Source

Check that `min <= max` in `clamp_finite` (#3699)

pull/3787/head
José Julián Espina 8 months ago committed by GitHub
parent
commit
5c20010328
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      core/engine/src/value/integer.rs

1
core/engine/src/value/integer.rs

@ -22,6 +22,7 @@ impl IntegerOrInfinity {
/// Panics if `min > max`. /// Panics if `min > max`.
#[must_use] #[must_use]
pub fn clamp_finite(self, min: i64, max: i64) -> i64 { pub fn clamp_finite(self, min: i64, max: i64) -> i64 {
assert!(min <= max);
match self { match self {
Self::Integer(i) => i.clamp(min, max), Self::Integer(i) => i.clamp(min, max),
Self::PositiveInfinity => max, Self::PositiveInfinity => max,

Loading…
Cancel
Save