Skip to content

Commit f9ef6c0

Browse files
bors[bot]cuviper
andauthored
Merge #51
51: Upgrade to 2018 edition, MSRV 1.31 r=cuviper a=cuviper Co-authored-by: Josh Stone <[email protected]>
2 parents 543e0c9 + b883758 commit f9ef6c0

File tree

17 files changed

+65
-133
lines changed

17 files changed

+65
-133
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
rust: [1.8.0, 1.15.0, 1.20.0, 1.26.0, 1.31.0, stable, beta, nightly]
15+
rust: [
16+
1.31.0, # MSRV
17+
stable,
18+
beta,
19+
nightly,
20+
]
1621
steps:
1722
- uses: actions/checkout@v3
1823
- uses: dtolnay/rust-toolchain@master
@@ -30,7 +35,7 @@ jobs:
3035
- uses: dtolnay/rust-toolchain@stable
3136
with:
3237
target: thumbv6m-none-eabi
33-
- run: cargo build --target thumbv6m-none-eabi --no-default-features --features i128
38+
- run: cargo build --target thumbv6m-none-eabi --no-default-features
3439

3540
fmt:
3641
name: Format

.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.8.0, stable]
16+
rust: [1.31.0, stable]
1717
steps:
1818
- uses: actions/checkout@v3
1919
- uses: dtolnay/rust-toolchain@master

.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.8.0, stable]
12+
rust: [1.31.0, stable]
1313
steps:
1414
- uses: actions/checkout@v3
1515
- uses: dtolnay/rust-toolchain@master

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ repository = "https://github.com/rust-num/num-integer"
1010
name = "num-integer"
1111
version = "0.1.45"
1212
readme = "README.md"
13-
build = "build.rs"
1413
exclude = ["/bors.toml", "/ci/*", "/.github/*"]
14+
edition = "2018"
15+
rust-version = "1.31"
1516

1617
[package.metadata.docs.rs]
1718
features = ["std"]
1819

1920
[dependencies.num-traits]
2021
version = "0.2.11"
2122
default-features = false
23+
features = ["i128"]
2224

2325
[features]
2426
default = ["std"]
25-
i128 = ["num-traits/i128"]
2627
std = ["num-traits/std"]
2728

28-
[build-dependencies]
29-
autocfg = "1"
29+
# vestigial features, now always in effect
30+
i128 = []

README.md

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

33
[![crate](https://img.shields.io/crates/v/num-integer.svg)](https://crates.io/crates/num-integer)
44
[![documentation](https://docs.rs/num-integer/badge.svg)](https://docs.rs/num-integer)
5-
[![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
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)
66
[![build status](https://github.com/rust-num/num-integer/workflows/master/badge.svg)](https://github.com/rust-num/num-integer/actions)
77

88
`Integer` trait and functions for Rust.
@@ -16,12 +16,6 @@ Add this to your `Cargo.toml`:
1616
num-integer = "0.1"
1717
```
1818

19-
and this to your crate root:
20-
21-
```rust
22-
extern crate num_integer;
23-
```
24-
2519
## Features
2620

2721
This crate can be used without the standard library (`#![no_std]`) by disabling
@@ -36,17 +30,13 @@ default-features = false
3630
There is no functional difference with and without `std` at this time, but
3731
there may be in the future.
3832

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

4535
Release notes are available in [RELEASES.md](RELEASES.md).
4636

4737
## Compatibility
4838

49-
The `num-integer` crate is tested for rustc 1.8 and greater.
39+
The `num-integer` crate is tested for rustc 1.31 and greater.
5040

5141
## License
5242

benches/average.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
#![feature(test)]
44

5-
extern crate num_integer;
6-
extern crate num_traits;
75
extern crate test;
86

97
use num_integer::Integer;
@@ -143,12 +141,10 @@ where
143141
assert_eq!(rt - a, b - rt + T::one());
144142
}
145143
// if both number have a different sign,
144+
} else if (a + b).is_even() {
145+
assert_eq!(rt, (a + b) / (T::one() + T::one()))
146146
} else {
147-
if (a + b).is_even() {
148-
assert_eq!(rt, (a + b) / (T::one() + T::one()))
149-
} else {
150-
assert_eq!(rt, (a + b + T::one()) / (T::one() + T::one()))
151-
}
147+
assert_eq!(rt, (a + b + T::one()) / (T::one() + T::one()))
152148
}
153149
}
154150
bench_unchecked(b, v, f);
@@ -170,12 +166,10 @@ where
170166
assert_eq!(rt - a + T::one(), b - rt);
171167
}
172168
// if both number have a different sign,
169+
} else if (a + b).is_even() {
170+
assert_eq!(rt, (a + b) / (T::one() + T::one()))
173171
} else {
174-
if (a + b).is_even() {
175-
assert_eq!(rt, (a + b) / (T::one() + T::one()))
176-
} else {
177-
assert_eq!(rt, (a + b - T::one()) / (T::one() + T::one()))
178-
}
172+
assert_eq!(rt, (a + b - T::one()) / (T::one() + T::one()))
179173
}
180174
}
181175
bench_unchecked(b, v, f);

benches/gcd.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
#![feature(test)]
44

5-
extern crate num_integer;
6-
extern crate num_traits;
75
extern crate test;
86

97
use num_integer::Integer;

benches/roots.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
#![feature(test)]
44

5-
extern crate num_integer;
6-
extern crate num_traits;
75
extern crate test;
86

97
use num_integer::Integer;
@@ -125,42 +123,42 @@ macro_rules! bench_roots {
125123

126124
#[bench]
127125
fn sqrt_rand(b: &mut Bencher) {
128-
::bench_rand_pos(b, $T::sqrt, 2);
126+
crate::bench_rand_pos(b, $T::sqrt, 2);
129127
}
130128

131129
#[bench]
132130
fn sqrt_small(b: &mut Bencher) {
133-
::bench_small_pos(b, $T::sqrt, 2);
131+
crate::bench_small_pos(b, $T::sqrt, 2);
134132
}
135133

136134
#[bench]
137135
fn cbrt_rand(b: &mut Bencher) {
138-
::bench_rand(b, $T::cbrt, 3);
136+
crate::bench_rand(b, $T::cbrt, 3);
139137
}
140138

141139
#[bench]
142140
fn cbrt_small(b: &mut Bencher) {
143-
::bench_small(b, $T::cbrt, 3);
141+
crate::bench_small(b, $T::cbrt, 3);
144142
}
145143

146144
#[bench]
147145
fn fourth_root_rand(b: &mut Bencher) {
148-
::bench_rand_pos(b, |x: &$T| x.nth_root(4), 4);
146+
crate::bench_rand_pos(b, |x: &$T| x.nth_root(4), 4);
149147
}
150148

151149
#[bench]
152150
fn fourth_root_small(b: &mut Bencher) {
153-
::bench_small_pos(b, |x: &$T| x.nth_root(4), 4);
151+
crate::bench_small_pos(b, |x: &$T| x.nth_root(4), 4);
154152
}
155153

156154
#[bench]
157155
fn fifth_root_rand(b: &mut Bencher) {
158-
::bench_rand(b, |x: &$T| x.nth_root(5), 5);
156+
crate::bench_rand(b, |x: &$T| x.nth_root(5), 5);
159157
}
160158

161159
#[bench]
162160
fn fifth_root_small(b: &mut Bencher) {
163-
::bench_small(b, |x: &$T| x.nth_root(5), 5);
161+
crate::bench_small(b, |x: &$T| x.nth_root(5), 5);
164162
}
165163
}
166164
)*}

bors.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
status = [
2-
"Test (1.8.0)",
3-
"Test (1.15.0)",
4-
"Test (1.20.0)",
5-
"Test (1.26.0)",
62
"Test (1.31.0)",
73
"Test (stable)",
84
"Test (beta)",

build.rs

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

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.8.0 1.15.0 1.20.0 1.26.0 1.31.0 stable beta nightly; do
8+
for version in 1.31.0 stable beta nightly; do
99
rustup run "$version" "$ci/test_full.sh"
1010
done

ci/test_full.sh

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

55
CRATE=num-integer
6-
MSRV=1.8
6+
MSRV=1.31
77

88
get_rust_version() {
99
local array=($(rustc --version));
@@ -28,7 +28,6 @@ if ! check_version $MSRV ; then
2828
fi
2929

3030
FEATURES=()
31-
check_version 1.26 && FEATURES+=(i128)
3231
echo "Testing supported features: ${FEATURES[*]}"
3332

3433
set -x

src/average.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use crate::Integer;
12
use core::ops::{BitAnd, BitOr, BitXor, Shr};
2-
use Integer;
33

44
/// Provides methods to compute the average of two integers, without overflows.
55
pub trait Average: Integer {

0 commit comments

Comments
 (0)