Stop using div_rem.

This commit is contained in:
Ms2ger 2015-01-04 11:38:27 +01:00
parent 138081ba25
commit af9a8bdc73

View file

@ -5,7 +5,6 @@
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::Hash; use std::hash::Hash;
use std::num::div_rem;
use sync::Arc; use sync::Arc;
use url::Url; use url::Url;
@ -1083,15 +1082,14 @@ fn matches_generic_nth_child<'a,E,N>(element: &N,
index += 1; index += 1;
} }
} }
} }
if a == 0 { 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] #[inline]