Skip to content

Commit d84e7ce

Browse files
bors[bot]vkscuviper
authored
Merge #65
65: Upgrade to Rand 0.7 r=cuviper a=vks This bumps the MSRV to 1.32 for the `rand` feature. `SmallRng` is not used for the tests anymore, since enabling the corresponding feature would force other crates to use the feature as well. Co-authored-by: Vinzent Steinberg <Vinzent.Steinberg@gmail.com> Co-authored-by: Josh Stone <cuviper@gmail.com>
2 parents 49528a7 + 69247ad commit d84e7ce

File tree

10 files changed

+21
-67
lines changed

10 files changed

+21
-67
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
language: rust
22
sudo: false
33
rust:
4-
- 1.15.0
5-
- 1.22.0 # rand
6-
- 1.26.0 # has_i128
74
- 1.31.0 # 2018!
5+
- 1.32.0 # rand
86
- stable
97
- beta
108
- nightly
@@ -20,7 +18,7 @@ matrix:
2018
before_script:
2119
- rustup target add $TARGET
2220
script:
23-
- cargo build --verbose --target $TARGET --no-default-features --features i128,rand,serde
21+
- cargo build --verbose --target $TARGET --no-default-features --features rand,serde
2422
- name: "rustfmt"
2523
rust: 1.31.0
2624
before_script:

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ name = "num-complex"
1010
repository = "https://github.com/rust-num/num-complex"
1111
version = "0.3.0-pre"
1212
readme = "README.md"
13-
build = "build.rs"
1413
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]
1514
publish = false
1615

@@ -22,6 +21,7 @@ features = ["std", "serde", "rand"]
2221
[dependencies.num-traits]
2322
version = "0.2.11"
2423
default-features = false
24+
features = ["i128"]
2525

2626
[dependencies.serde]
2727
optional = true
@@ -30,13 +30,9 @@ default-features = false
3030

3131
[dependencies.rand]
3232
optional = true
33-
version = "0.5"
33+
version = "0.7"
3434
default-features = false
3535

3636
[features]
3737
default = ["std"]
38-
i128 = ["num-traits/i128"]
3938
std = ["num-traits/std"]
40-
41-
[build-dependencies]
42-
autocfg = "1"

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![crate](https://img.shields.io/crates/v/num-complex.svg)](https://crates.io/crates/num-complex)
44
[![documentation](https://docs.rs/num-complex/badge.svg)](https://docs.rs/num-complex)
5-
![minimum rustc 1.15](https://img.shields.io/badge/rustc-1.15+-red.svg)
5+
![minimum rustc 1.31](https://img.shields.io/badge/rustc-1.31+-red.svg)
66
[![Travis status](https://travis-ci.org/rust-num/num-complex.svg?branch=master)](https://travis-ci.org/rust-num/num-complex)
77

88
`Complex` numbers for Rust.
@@ -13,7 +13,7 @@ Add this to your `Cargo.toml`:
1313

1414
```toml
1515
[dependencies]
16-
num-complex = "0.2"
16+
num-complex = "0.3"
1717
```
1818

1919
and this to your crate root:
@@ -29,22 +29,18 @@ the default `std` feature. Use this in `Cargo.toml`:
2929

3030
```toml
3131
[dependencies.num-complex]
32-
version = "0.2"
32+
version = "0.3"
3333
default-features = false
3434
```
3535

3636
Features based on `Float` types are only available when `std` is enabled. Where
3737
possible, `FloatCore` is used instead. Formatting complex numbers only supports
3838
format width when `std` is enabled.
3939

40-
Implementations for `i128` and `u128` are only available with Rust 1.26 and
41-
later. The build script automatically detects this, but you can make it
42-
mandatory by enabling the `i128` crate feature.
43-
4440
## Releases
4541

4642
Release notes are available in [RELEASES.md](RELEASES.md).
4743

4844
## Compatibility
4945

50-
The `num-complex` crate is tested for rustc 1.15 and greater.
46+
The `num-complex` crate is tested for rustc 1.31 and greater.

build.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

ci/rustup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set -ex
66

77
export TRAVIS_RUST_VERSION
8-
for TRAVIS_RUST_VERSION in 1.15.0 1.22.0 1.26.0 stable beta nightly; do
8+
for TRAVIS_RUST_VERSION in 1.31.0 1.32.0 stable beta nightly; do
99
run="rustup run $TRAVIS_RUST_VERSION"
1010
$run cargo build --verbose
1111
$run $PWD/ci/test_full.sh

ci/test_full.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ set -ex
44

55
echo Testing num-complex on rustc ${TRAVIS_RUST_VERSION}
66

7-
FEATURES="std serde"
8-
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0|1.22.0)$ ]]; then
9-
FEATURES="$FEATURES rand"
10-
fi
11-
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0)$ ]]; then
12-
FEATURES="$FEATURES i128"
13-
fi
7+
case "$TRAVIS_RUST_VERSION" in
8+
1.31.*) FEATURES="serde" ;;
9+
*) FEATURES="serde rand" ;;
10+
esac
1411

1512
# num-complex should build and test everywhere.
1613
cargo build --verbose
@@ -29,3 +26,7 @@ done
2926
# test all supported features together
3027
cargo build --features="$FEATURES"
3128
cargo test --features="$FEATURES"
29+
30+
# test all supported features together with std
31+
cargo build --features="std $FEATURES"
32+
cargo test --features="std $FEATURES"

src/cast.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ impl<T: ToPrimitive + Num> ToPrimitive for Complex<T> {
2222
impl_to_primitive!(i16, to_i16);
2323
impl_to_primitive!(i32, to_i32);
2424
impl_to_primitive!(i64, to_i64);
25-
#[cfg(has_i128)]
2625
impl_to_primitive!(u128, to_u128);
27-
#[cfg(has_i128)]
2826
impl_to_primitive!(i128, to_i128);
2927
impl_to_primitive!(f32, to_f32);
3028
impl_to_primitive!(f64, to_f64);
@@ -53,9 +51,7 @@ impl<T: FromPrimitive + Num> FromPrimitive for Complex<T> {
5351
impl_from_primitive!(i16, from_i16);
5452
impl_from_primitive!(i32, from_i32);
5553
impl_from_primitive!(i64, from_i64);
56-
#[cfg(has_i128)]
5754
impl_from_primitive!(u128, from_u128);
58-
#[cfg(has_i128)]
5955
impl_from_primitive!(i128, from_i128);
6056
impl_from_primitive!(f32, from_f32);
6157
impl_from_primitive!(f64, from_f64);

src/crand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ where
4242
}
4343

4444
#[cfg(test)]
45-
fn test_rng() -> SmallRng {
46-
SmallRng::from_seed([42; 16])
45+
fn test_rng() -> StdRng {
46+
StdRng::from_seed([42; 32])
4747
}
4848

4949
#[test]

src/lib.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
//!
1313
//! ## Compatibility
1414
//!
15-
//! The `num-complex` crate is tested for rustc 1.15 and greater.
15+
//! The `num-complex` crate is tested for rustc 1.31 and greater.
1616
17-
#![doc(html_root_url = "https://docs.rs/num-complex/0.2")]
17+
#![doc(html_root_url = "https://docs.rs/num-complex/0.3")]
1818
#![no_std]
1919

2020
#[cfg(any(test, feature = "std"))]
@@ -93,19 +93,11 @@ pub type Complex32 = Complex<f32>;
9393
pub type Complex64 = Complex<f64>;
9494

9595
impl<T> Complex<T> {
96-
#[cfg(has_const_fn)]
9796
/// Create a new Complex
9897
#[inline]
9998
pub const fn new(re: T, im: T) -> Self {
10099
Complex { re: re, im: im }
101100
}
102-
103-
#[cfg(not(has_const_fn))]
104-
/// Create a new Complex
105-
#[inline]
106-
pub fn new(re: T, im: T) -> Self {
107-
Complex { re: re, im: im }
108-
}
109101
}
110102

111103
impl<T: Clone + Num> Complex<T> {
@@ -1086,9 +1078,6 @@ impl<T: Clone + Num> Rem<T> for Complex<T> {
10861078
}
10871079
}
10881080

1089-
#[cfg(not(has_i128))]
1090-
real_arithmetic!(usize, u8, u16, u32, u64, isize, i8, i16, i32, i64, f32, f64);
1091-
#[cfg(has_i128)]
10921081
real_arithmetic!(usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64);
10931082

10941083
/* constants */
@@ -2650,7 +2639,6 @@ mod test {
26502639
assert!(c.is_one());
26512640
}
26522641

2653-
#[cfg(has_const_fn)]
26542642
#[test]
26552643
fn test_const() {
26562644
const R: f64 = 12.3;

src/pow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ pow_impl!(u16, i16);
7676
pow_impl!(u32, i32);
7777
pow_impl!(u64, i64);
7878
pow_impl!(usize, isize);
79-
#[cfg(has_i128)]
8079
pow_impl!(u128, i128);
8180

8281
// Note: we can't add `impl<T: Float> Pow<T> for Complex<T>` because new blanket impls are a

0 commit comments

Comments
 (0)