From a49c0acc483f184fb5cfc9286861e83030e3e665 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 5 Mar 2021 13:35:44 -0800 Subject: [PATCH 1/2] Release 0.4.0 --- Cargo.toml | 3 +-- README.md | 4 ++-- RELEASES.md | 17 +++++++++++++++++ src/lib.rs | 11 ++++++----- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 85ba6b14..3de8c72c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,7 @@ categories = [ "algorithms", "data-structures", "science" ] license = "MIT OR Apache-2.0" name = "num-bigint" repository = "https://github.com/rust-num/num-bigint" -version = "0.4.0-pre" -publish = false +version = "0.4.0" readme = "README.md" build = "build.rs" exclude = ["/bors.toml", "/ci/*", "/.github/*"] diff --git a/README.md b/README.md index 3311b7a8..d1cedad1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -num-bigint = "0.3" +num-bigint = "0.4" ``` ## Features @@ -30,7 +30,7 @@ feature is enabled. To enable it include rand as ```toml rand = "0.8" -num-bigint = { version = "0.3", features = ["rand"] } +num-bigint = { version = "0.4", features = ["rand"] } ``` Note that you must use the version of `rand` that `num-bigint` is compatible diff --git a/RELEASES.md b/RELEASES.md index f7897041..fd07b1ec 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,20 @@ +# Release 0.4.0 (2021-03-05) + +### Breaking Changes + +- Updated public dependences on [arbitrary, quickcheck][194], and [rand][185]: + - `arbitrary` support has been updated to 1.0, requiring Rust 1.40. + - `quickcheck` support has been updated to 1.0, requiring Rust 1.46. + - `rand` support has been updated to 0.8, requiring Rust 1.36. +- [`Debug` now shows plain numeric values for `BigInt` and `BigUint`][195], + rather than the raw list of internal digits. + +**Contributors**: @cuviper, @Gelbpunkt + +[185]: https://github.com/rust-num/num-bigint/pull/185 +[194]: https://github.com/rust-num/num-bigint/pull/194 +[195]: https://github.com/rust-num/num-bigint/pull/195 + # Release 0.3.2 (2021-03-04) - [The new `BigUint` methods `count_ones` and `trailing_ones`][175] return the diff --git a/src/lib.rs b/src/lib.rs index a4ab704a..b88c5df2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,19 +72,20 @@ //! feature is enabled. To enable it include rand as //! //! ```toml -//! rand = "0.7" -//! num-bigint = { version = "0.3", features = ["rand"] } +//! rand = "0.8" +//! num-bigint = { version = "0.4", features = ["rand"] } //! ``` //! //! Note that you must use the version of `rand` that `num-bigint` is compatible -//! with: `0.7`. +//! with: `0.8`. //! //! //! ## Compatibility //! //! The `num-bigint` crate is tested for rustc 1.31 and greater. -#![doc(html_root_url = "https://docs.rs/num-bigint/0.3")] +#![doc(html_root_url = "https://docs.rs/num-bigint/0.4")] +#![warn(rust_2018_idioms)] #![no_std] #[cfg(feature = "std")] @@ -221,7 +222,7 @@ where #[cfg(has_try_from)] impl fmt::Display for TryFromBigIntError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } From 4b7c9d78c556eb2cc8664285c3c986b1d9b5bdff Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 5 Mar 2021 13:46:01 -0800 Subject: [PATCH 2/2] Fix clippy::needless_range_loop --- src/bigint/bits.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bigint/bits.rs b/src/bigint/bits.rs index c66830e5..686def4d 100644 --- a/src/bigint/bits.rs +++ b/src/bigint/bits.rs @@ -517,8 +517,8 @@ pub(super) fn set_negative_bit(x: &mut BigInt, bit: u64, value: bool) { digits[index_lo] ^= bit_mask_lo & bit_mask_hi; } else { digits[index_lo] = bit_mask_lo; - for index in (index_lo + 1)..index_hi { - digits[index] = big_digit::MAX; + for digit in &mut digits[index_lo + 1..index_hi] { + *digit = big_digit::MAX; } digits[index_hi] ^= bit_mask_hi; }