Skip to content

Commit d60fba8

Browse files
committed
Update to current rust: don't use cmp::min/max on floats.
1 parent ca06a86 commit d60fba8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

color.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
use std::ascii::StrAsciiExt;
6-
use std::cmp;
76

87
use ast::*;
98

@@ -298,9 +297,9 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue])
298297
let hue = expect_number!() / 360.;
299298
let hue = hue - hue.floor();
300299
expect_comma!();
301-
let saturation = cmp::min(cmp::max((expect_percentage!() / 100.), 0.), 1.);
300+
let saturation = (expect_percentage!() / 100.).min(0.).max(1.);
302301
expect_comma!();
303-
let lightness = cmp::min(cmp::max((expect_percentage!() / 100.), 0.), 1.);
302+
let lightness = (expect_percentage!() / 100.).min(0.).max(1.);
304303

305304
// http://www.w3.org/TR/css3-color/#hsl-color
306305
fn hue_to_rgb(m1: f64, m2: f64, mut h: f64) -> f64 {
@@ -322,7 +321,7 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue])
322321

323322
let alpha = if has_alpha {
324323
expect_comma!();
325-
cmp::min(cmp::max((expect_number!()), 0.), 1.) as f32
324+
(expect_number!()).min(0.).max(1.) as f32
326325
} else {
327326
1.
328327
};

0 commit comments

Comments
 (0)