Skip to content

Commit 3a9eca3

Browse files
committed
Move std::num::Integer to libnum
1 parent 2fa7d6b commit 3a9eca3

File tree

12 files changed

+439
-421
lines changed

12 files changed

+439
-421
lines changed

src/etc/vim/syntax/rust.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator Cloneabl
8585
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
8686

8787
syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
88-
syn keyword rustTrait Bitwise Bounded Integer
88+
syn keyword rustTrait Bitwise Bounded Fractional
8989
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv
9090
syn keyword rustTrait Orderable Signed Unsigned Round
9191
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive

src/libnum/bigint.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ A `BigUint` is represented as an array of `BigDigit`s.
1616
A `BigInt` is a combination of `BigUint` and `Sign`.
1717
*/
1818

19+
use Integer;
20+
1921
use std::cmp;
2022
use std::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2123
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
@@ -461,7 +463,7 @@ impl Integer for BigUint {
461463

462464
/// Returns `true` if the number can be divided by `other` without leaving a remainder
463465
#[inline]
464-
fn is_multiple_of(&self, other: &BigUint) -> bool { (*self % *other).is_zero() }
466+
fn divides(&self, other: &BigUint) -> bool { (*self % *other).is_zero() }
465467

466468
/// Returns `true` if the number is divisible by `2`
467469
#[inline]
@@ -1118,7 +1120,7 @@ impl Integer for BigInt {
11181120

11191121
/// Returns `true` if the number can be divided by `other` without leaving a remainder
11201122
#[inline]
1121-
fn is_multiple_of(&self, other: &BigInt) -> bool { self.data.is_multiple_of(&other.data) }
1123+
fn divides(&self, other: &BigInt) -> bool { self.data.divides(&other.data) }
11221124

11231125
/// Returns `true` if the number is divisible by `2`
11241126
#[inline]
@@ -1388,6 +1390,7 @@ impl BigInt {
13881390
13891391
#[cfg(test)]
13901392
mod biguint_tests {
1393+
use Integer;
13911394
use super::{BigDigit, BigUint, ToBigUint};
13921395
use super::{Plus, BigInt, RandBigInt, ToBigInt};
13931396
@@ -2045,6 +2048,7 @@ mod biguint_tests {
20452048

20462049
#[cfg(test)]
20472050
mod bigint_tests {
2051+
use Integer;
20482052
use super::{BigDigit, BigUint, ToBigUint};
20492053
use super::{Sign, Minus, Zero, Plus, BigInt, RandBigInt, ToBigInt};
20502054

0 commit comments

Comments
 (0)