Skip to content

Commit 916942d

Browse files
committed
Some cosmetic changes to num.rs
1 parent c34c505 commit 916942d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/libcore/num/num.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,15 @@ pub trait FromStrRadix {
396396
/// - If code written to use this function doesn't care about it, it's
397397
/// probably assuming that `x^0` always equals `1`.
398398
///
399-
pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Div<T,T>+Mul<T,T>>(
400-
radix: uint, pow: uint) -> T {
399+
pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Div<T,T>+Mul<T,T>>(radix: uint, pow: uint) -> T {
401400
let _0: T = Zero::zero();
402401
let _1: T = One::one();
403402

404403
if pow == 0u { return _1; }
405404
if radix == 0u { return _0; }
406405
let mut my_pow = pow;
407406
let mut total = _1;
408-
let mut multiplier = cast(radix as int);
407+
let mut multiplier = cast(radix);
409408
while (my_pow > 0u) {
410409
if my_pow % 2u == 1u {
411410
total *= multiplier;
@@ -422,13 +421,13 @@ pub fn test_num<T:Num + NumCast>(ten: T, two: T) {
422421
assert_eq!(ten.add(&two), cast(12));
423422
assert_eq!(ten.sub(&two), cast(8));
424423
assert_eq!(ten.mul(&two), cast(20));
425-
assert_eq!(ten.div(&two), cast(5));
424+
assert_eq!(ten.div(&two), cast(5));
426425
assert_eq!(ten.rem(&two), cast(0));
427426

428427
assert_eq!(ten.add(&two), ten + two);
429428
assert_eq!(ten.sub(&two), ten - two);
430429
assert_eq!(ten.mul(&two), ten * two);
431-
assert_eq!(ten.div(&two), ten / two);
430+
assert_eq!(ten.div(&two), ten / two);
432431
assert_eq!(ten.rem(&two), ten % two);
433432
}
434433

0 commit comments

Comments
 (0)