From af9a8bdc736ecb8f86b69ee9f21bdb2ea6f1c2d1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 4 Jan 2015 11:38:27 +0100 Subject: [PATCH] Stop using div_rem. --- components/style/selector_matching.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 203c70ff7f5..f1ef941f517 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -5,7 +5,6 @@ use std::ascii::AsciiExt; use std::collections::HashMap; use std::hash::Hash; -use std::num::div_rem; use sync::Arc; use url::Url; @@ -1083,15 +1082,14 @@ fn matches_generic_nth_child<'a,E,N>(element: &N, index += 1; } } - } if a == 0 { - return b == index; + b == index + } else { + (index - b) / a >= 0 && + (index - b) % a == 0 } - - let (n, r) = div_rem(index - b, a); - n >= 0 && r == 0 } #[inline]