Skip to content

Commit 681bbf8

Browse files
committed
Auto merge of #300 - cuviper:no-default-subcrates, r=cuviper
Test and fix subcrates with --no-default-features - The CI script now tests them all with --no-default-features. - bigint: testing needs rand even when the main feature is disabled. - rational: gate `FromPrimitive for Ratio<BigInt>` on having bigint.
2 parents f809c79 + 8b9cdaa commit 681bbf8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

bigint/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ version = "0.3.19"
3131
optional = true
3232
version = ">= 0.7.0, < 0.9.0"
3333

34+
[dev-dependencies.rand]
35+
version = "0.3.14"
36+
3437
[features]
3538
default = ["rand", "rustc-serialize"]

ci/test_full.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ for package in bigint complex integer iter rational traits; do
1010
cargo test --manifest-path $package/Cargo.toml
1111
done
1212

13-
# Only num-traits supports no_std at the moment.
14-
cargo build --manifest-path traits/Cargo.toml --no-default-features
15-
cargo test --manifest-path traits/Cargo.toml --no-default-features
13+
# They all should build with minimal features too
14+
for package in bigint complex integer iter rational traits; do
15+
cargo build --manifest-path $package/Cargo.toml --no-default-features
16+
cargo test --manifest-path $package/Cargo.toml --no-default-features
17+
done
1618

1719
# Each isolated feature should also work everywhere.
1820
for feature in '' bigint rational complex; do

rational/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ mod test {
860860
use std::str::FromStr;
861861
use std::i32;
862862
use std::f64;
863-
use traits::{Zero, One, Signed, FromPrimitive, Float};
863+
use traits::{Zero, One, Signed, FromPrimitive};
864864

865865
pub const _0: Rational = Ratio {
866866
numer: 0,
@@ -1302,6 +1302,7 @@ mod test {
13021302
#[cfg(feature = "num-bigint")]
13031303
#[test]
13041304
fn test_from_float() {
1305+
use traits::Float;
13051306
fn test<T: Float>(given: T, (numer, denom): (&str, &str)) {
13061307
let ratio: BigRational = Ratio::from_float(given).unwrap();
13071308
assert_eq!(ratio,

0 commit comments

Comments
 (0)