diff --git a/Cargo.toml b/Cargo.toml index 42895c92..dda25c25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = ["bitcoin", "hashes", "internals", "fuzz", "io"] +resolver = "2" [patch.crates-io.bitcoin] path = "bitcoin" diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml index aa9f6159..7afb1864 100644 --- a/bitcoin/Cargo.toml +++ b/bitcoin/Cargo.toml @@ -9,7 +9,7 @@ description = "General purpose library for using and interoperating with Bitcoin categories = ["cryptography::cryptocurrencies"] keywords = [ "crypto", "bitcoin" ] readme = "../README.md" -edition = "2018" +edition = "2021" exclude = ["tests", "contrib"] [features] diff --git a/bitcoin/embedded/Cargo.toml b/bitcoin/embedded/Cargo.toml index 9ea41c17..726f3857 100644 --- a/bitcoin/embedded/Cargo.toml +++ b/bitcoin/embedded/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Riccardo Casatta ", "Dev Random "] -edition = "2018" +edition = "2021" readme = "README.md" name = "embedded" version = "0.1.0" diff --git a/bitcoin/src/blockdata/locktime/absolute.rs b/bitcoin/src/blockdata/locktime/absolute.rs index ceb25121..fed21aab 100644 --- a/bitcoin/src/blockdata/locktime/absolute.rs +++ b/bitcoin/src/blockdata/locktime/absolute.rs @@ -374,14 +374,12 @@ impl<'de> serde::Deserialize<'de> for LockTime { // calls visit_u64, even when called from Deserializer::deserialize_u32. The // other visit_u*s have default implementations that forward to visit_u64. fn visit_u64(self, v: u64) -> Result { - use core::convert::TryInto; v.try_into().map_err(|_| { E::invalid_value(serde::de::Unexpected::Unsigned(v), &"a 32-bit number") }) } // Also do the signed version, just for good measure. fn visit_i64(self, v: i64) -> Result { - use core::convert::TryInto; v.try_into().map_err(|_| { E::invalid_value(serde::de::Unexpected::Signed(v), &"a 32-bit number") }) diff --git a/bitcoin/src/pow.rs b/bitcoin/src/pow.rs index cc25654a..bb095b07 100644 --- a/bitcoin/src/pow.rs +++ b/bitcoin/src/pow.rs @@ -834,8 +834,6 @@ impl crate::serde::Serialize for U256 { #[cfg(feature = "serde")] impl<'de> crate::serde::Deserialize<'de> for U256 { fn deserialize>(d: D) -> Result { - use core::convert::TryInto; - use hex::FromHex; use crate::serde::de; diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index c40270cc..b897bdfb 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitcoin-fuzz" -edition = "2018" +edition = "2021" version = "0.0.1" authors = ["Generated by fuzz/generate-files.sh"] publish = false diff --git a/fuzz/generate-files.sh b/fuzz/generate-files.sh index 25af8989..39105af4 100755 --- a/fuzz/generate-files.sh +++ b/fuzz/generate-files.sh @@ -11,7 +11,7 @@ source "$REPO_DIR/fuzz/fuzz-util.sh" cat > "$REPO_DIR/fuzz/Cargo.toml" <"] -edition = "2018" +edition = "2021" readme = "README.md" name = "embedded" version = "0.1.0" diff --git a/hashes/extended_tests/schemars/Cargo.toml b/hashes/extended_tests/schemars/Cargo.toml index 8a8943d2..d25cec04 100644 --- a/hashes/extended_tests/schemars/Cargo.toml +++ b/hashes/extended_tests/schemars/Cargo.toml @@ -2,7 +2,7 @@ name = "schemars" version = "0.1.0" authors = ["Jeremy Rubin "] -edition = "2018" +edition = "2021" # Prevent this from interfering with workspaces [workspace] diff --git a/hashes/src/sha1.rs b/hashes/src/sha1.rs index 79eab8f5..0520ff34 100644 --- a/hashes/src/sha1.rs +++ b/hashes/src/sha1.rs @@ -102,10 +102,10 @@ impl HashEngine { for (i, &wi) in w.iter().enumerate() { let (f, k) = match i { - 0...19 => ((b & c) | (!b & d), 0x5a827999), - 20...39 => (b ^ c ^ d, 0x6ed9eba1), - 40...59 => ((b & c) | (b & d) | (c & d), 0x8f1bbcdc), - 60...79 => (b ^ c ^ d, 0xca62c1d6), + 0..=19 => ((b & c) | (!b & d), 0x5a827999), + 20..=39 => (b ^ c ^ d, 0x6ed9eba1), + 40..=59 => ((b & c) | (b & d) | (c & d), 0x8f1bbcdc), + 60..=79 => (b ^ c ^ d, 0xca62c1d6), _ => unreachable!(), }; diff --git a/internals/Cargo.toml b/internals/Cargo.toml index e9889dc0..56247424 100644 --- a/internals/Cargo.toml +++ b/internals/Cargo.toml @@ -9,7 +9,7 @@ description = "Internal types and macros used by rust-bitcoin ecosystem" categories = ["cryptography::cryptocurrencies"] keywords = ["internal"] readme = "README.md" -edition = "2018" +edition = "2021" exclude = ["tests", "contrib"] [features] diff --git a/rustfmt.toml b/rustfmt.toml index 2c104735..93e688a2 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -57,7 +57,7 @@ trailing_comma = "Vertical" match_block_trailing_comma = false blank_lines_upper_bound = 1 blank_lines_lower_bound = 0 -edition = "2018" +edition = "2021" version = "One" inline_attribute_width = 0 format_generated_files = true