Open Bug 1857978 Opened 3 years ago

normalize_hue could use rem_euclid

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

People

(Reporter: mstange, Unassigned)

Details

https://searchfox.org/mozilla-central/rev/699a7704521354cac1e6a0679029c89ca899e25c/servo/components/style/color/convert.rs#20-24

/// Normalize hue into [0, 360).
#[inline]
fn normalize_hue(hue: f32) -> f32 {
    hue - 360. * (hue / 360.).floor()
}

I think this could just be hue.rem_euclid(360.) . This method was stabilized in Rust 1.38.

You need to log in before you can comment on or make changes to this bug.