Update to edition 2021

We just bumped the MSRV to Rust 1.56.1 which includes edition 2021.

Update all crates in this repo to use edition 2021 and build/lint
warnings.
This commit is contained in:
Tobin C. Harding 2023-11-15 09:14:56 +11:00
parent d9cc724187
commit a41e978855
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
13 changed files with 14 additions and 17 deletions

View File

@ -1,5 +1,6 @@
[workspace]
members = ["bitcoin", "hashes", "internals", "fuzz", "io"]
resolver = "2"
[patch.crates-io.bitcoin]
path = "bitcoin"

View File

@ -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]

View File

@ -1,6 +1,6 @@
[package]
authors = ["Riccardo Casatta <riccardo@casatta.it>", "Dev Random <c1.devrandom@niftybox.net>"]
edition = "2018"
edition = "2021"
readme = "README.md"
name = "embedded"
version = "0.1.0"

View File

@ -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<E: serde::de::Error>(self, v: u64) -> Result<u32, E> {
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<E: serde::de::Error>(self, v: i64) -> Result<u32, E> {
use core::convert::TryInto;
v.try_into().map_err(|_| {
E::invalid_value(serde::de::Unexpected::Signed(v), &"a 32-bit number")
})

View File

@ -834,8 +834,6 @@ impl crate::serde::Serialize for U256 {
#[cfg(feature = "serde")]
impl<'de> crate::serde::Deserialize<'de> for U256 {
fn deserialize<D: crate::serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
use core::convert::TryInto;
use hex::FromHex;
use crate::serde::de;

View File

@ -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

View File

@ -11,7 +11,7 @@ source "$REPO_DIR/fuzz/fuzz-util.sh"
cat > "$REPO_DIR/fuzz/Cargo.toml" <<EOF
[package]
name = "bitcoin-fuzz"
edition = "2018"
edition = "2021"
version = "0.0.1"
authors = ["Generated by fuzz/generate-files.sh"]
publish = false

View File

@ -9,7 +9,7 @@ description = "Hash functions used by the rust-bitcoin eccosystem"
categories = ["algorithms"]
keywords = [ "crypto", "bitcoin", "hash", "digest" ]
readme = "README.md"
edition = "2018"
edition = "2021"
exclude = ["tests", "contrib"]
[features]

View File

@ -1,6 +1,6 @@
[package]
authors = ["Riccardo Casatta <riccardo@casatta.it>"]
edition = "2018"
edition = "2021"
readme = "README.md"
name = "embedded"
version = "0.1.0"

View File

@ -2,7 +2,7 @@
name = "schemars"
version = "0.1.0"
authors = ["Jeremy Rubin <j@rubin.io>"]
edition = "2018"
edition = "2021"
# Prevent this from interfering with workspaces
[workspace]

View File

@ -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!(),
};

View File

@ -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]

View File

@ -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