Skip to content

Commit f66164b

Browse files
authored
Merge pull request #121 from cuviper/msrv-1.60
Use namespaced-features to safely bump to MSRV 1.60
2 parents 0eb3e90 + 0c3f2ef commit f66164b

File tree

8 files changed

+19
-32
lines changed

8 files changed

+19
-32
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
rust: [
12-
1.31.0, # 2018!
13-
1.36.0, # rand
14-
1.54.0, # rkyv
12+
1.60.0, # MSRV
1513
stable,
1614
beta,
1715
nightly

.github/workflows/master.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
rust: [1.31.0, stable]
16+
rust: [1.60.0, stable]
1717
steps:
1818
- uses: actions/checkout@v4
1919
- uses: actions/cache@v4

.github/workflows/pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
rust: [1.31.0, stable]
12+
rust: [1.60.0, stable]
1313
steps:
1414
- uses: actions/checkout@v4
1515
- uses: actions/cache@v4

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ repository = "https://github.com/rust-num/num-complex"
1111
version = "0.4.5"
1212
readme = "README.md"
1313
exclude = ["/ci/*", "/.github/*"]
14-
edition = "2018"
14+
edition = "2021"
15+
rust-version = "1.60"
1516

1617
[package.metadata.docs.rs]
1718
features = ["bytemuck", "std", "serde", "rkyv/size_64", "bytecheck", "rand"]
@@ -51,3 +52,8 @@ default-features = false
5152
default = ["std"]
5253
std = ["num-traits/std"]
5354
libm = ["num-traits/libm"]
55+
bytecheck = ["dep:bytecheck"]
56+
bytemuck = ["dep:bytemuck"]
57+
rand = ["dep:rand"]
58+
rkyv = ["dep:rkyv"]
59+
serde = ["dep:serde"]

README.md

Lines changed: 2 additions & 2 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.31](https://img.shields.io/badge/rustc-1.31+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
5+
[![minimum rustc 1.60](https://img.shields.io/badge/rustc-1.60+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
66
[![build status](https://github.com/rust-num/num-complex/workflows/master/badge.svg)](https://github.com/rust-num/num-complex/actions)
77

88
`Complex` numbers for Rust.
@@ -37,7 +37,7 @@ Release notes are available in [RELEASES.md](RELEASES.md).
3737

3838
## Compatibility
3939

40-
The `num-complex` crate is tested for rustc 1.31 and greater.
40+
The `num-complex` crate is tested for rustc 1.60 and greater.
4141

4242
## License
4343

ci/rustup.sh

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

77
ci=$(dirname $0)
8-
for version in 1.31.0 1.36.0 1.54.0 stable beta nightly; do
8+
for version in 1.60.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
CRATE=num-complex
6-
MSRV=1.31
6+
MSRV=1.60
77

88
get_rust_version() {
99
local array=($(rustc --version));
@@ -27,26 +27,11 @@ if ! check_version $MSRV ; then
2727
exit 1
2828
fi
2929

30-
FEATURES=(libm serde)
31-
check_version 1.34 && FEATURES+=(bytemuck)
32-
check_version 1.36 && FEATURES+=(rand)
33-
check_version 1.54 && FEATURES+=(rkyv/size_64 bytecheck)
30+
FEATURES=(bytecheck bytemuck libm rand rkyv/size_64 serde)
3431
echo "Testing supported features: ${FEATURES[*]}"
3532

3633
cargo generate-lockfile
3734

38-
# libm 0.2.6 started using {float}::EPSILON
39-
check_version 1.43 || cargo update -p libm --precise 0.2.5
40-
41-
# Some crates moved to Rust 1.56 / 2021
42-
check_version 1.56 || (
43-
cargo update -p serde --precise 1.0.185
44-
cargo update -p quote --precise 1.0.30
45-
cargo update -p proc-macro2 --precise 1.0.65
46-
cargo update -p rkyv --precise 0.7.40
47-
cargo update -p bytecheck --precise 0.6.9
48-
)
49-
5035
set -x
5136

5237
# test the default

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,11 @@ impl<T: Float> Complex<T> {
213213
if !im.is_finite() {
214214
return Self::new(T::zero(), T::zero());
215215
}
216-
} else {
217-
if im == T::zero() || !im.is_finite() {
218-
if im.is_infinite() {
219-
im = T::nan();
220-
}
221-
return Self::new(re, im);
216+
} else if im == T::zero() || !im.is_finite() {
217+
if im.is_infinite() {
218+
im = T::nan();
222219
}
220+
return Self::new(re, im);
223221
}
224222
} else if re.is_nan() && im == T::zero() {
225223
return self;

0 commit comments

Comments
 (0)