From e970e7117f03d41103ca677c3d15e583538090c9 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 11 Dec 2021 00:41:24 -0800 Subject: [PATCH] Enable 128-bit impls unconditionally --- .github/workflows/ci.yml | 13 ++++++------- Cargo.toml | 1 - README.md | 3 +-- benches/bench.rs | 2 -- src/lib.rs | 4 ---- tests/test.rs | 3 --- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 386b76a..c8e329f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,13 +19,12 @@ jobs: with: toolchain: ${{matrix.rust}} - run: cargo build - - run: cargo build --features i128 - - run: cargo test --features i128 - - run: cargo test --features i128 --release - - run: cargo build --no-default-features --features i128 - - run: cargo test --tests --no-default-features --features i128 - - run: cargo test --tests --no-default-features --features i128 --release - - run: cargo bench --no-run --features i128 + - run: cargo test + - run: cargo test --release + - run: cargo build --no-default-features + - run: cargo test --tests --no-default-features + - run: cargo test --tests --no-default-features --release + - run: cargo bench --no-run if: matrix.rust == 'nightly' miri: diff --git a/Cargo.toml b/Cargo.toml index 35c352f..39409e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ edition = "2018" [features] default = ["std"] -i128 = [] std = [] [package.metadata.docs.rs] diff --git a/README.md b/README.md index 6a3044b..37c8271 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,7 @@ fn fmt(writer: W, value: V) -> fmt::Result; ``` where `itoa::Integer` is implemented for i8, u8, i16, u16, i32, u32, i64, u64, -i128, u128, isize and usize. 128-bit integer support requires rustc 1.26+ and -the `i128` feature of this crate enabled. +i128, u128, isize and usize. The `write` function is only available when the `std` feature is enabled (default is enabled). The return value gives the number of bytes written. diff --git a/benches/bench.rs b/benches/bench.rs index e9e87f0..31f5499 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -76,8 +76,6 @@ benches! { bench_i16_0(0i16), bench_i16_min(::min_value()), - #[cfg(feature = "i128")] bench_u128_0(0u128), - #[cfg(feature = "i128")] bench_u128_max(::max_value()) } diff --git a/src/lib.rs b/src/lib.rs index 6f01544..92feea6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,7 +69,6 @@ clippy::unreadable_literal )] -#[cfg(feature = "i128")] mod udiv128; #[cfg(feature = "std")] @@ -289,7 +288,6 @@ impl_Integer!(I32_MAX_LEN => isize, U32_MAX_LEN => usize as u32); #[cfg(target_pointer_width = "64")] impl_Integer!(I64_MAX_LEN => isize, U64_MAX_LEN => usize as u64); -#[cfg(all(feature = "i128"))] macro_rules! impl_Integer128 { ($($max_len:expr => $t:ident),*) => {$( impl_IntegerCommon!($max_len, $t); @@ -351,9 +349,7 @@ macro_rules! impl_Integer128 { )*}; } -#[cfg(all(feature = "i128"))] const U128_MAX_LEN: usize = 39; const I128_MAX_LEN: usize = 40; -#[cfg(all(feature = "i128"))] impl_Integer128!(I128_MAX_LEN => i128, U128_MAX_LEN => u128); diff --git a/tests/test.rs b/tests/test.rs index e68fcfc..a2c7ab0 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -38,10 +38,7 @@ test! { test_i16_0(0i16, "0"), test_i16_min(::min_value(), "-32768"), - #[cfg(feature = "i128")] test_u128_0(0u128, "0"), - #[cfg(feature = "i128")] test_u128_max(::max_value(), "340282366920938463463374607431768211455"), - #[cfg(feature = "i128")] test_i128_min(::min_value(), "-170141183460469231731687303715884105728") }