From 43953c250a991fb0a10b813f2b736d83bddc3d2e Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 21:27:37 -0500 Subject: [PATCH 01/12] Rust edition 2021: zebra-network, cargo fix --edition and clippy --fix --- zebra-network/Cargo.toml | 2 +- zebra-network/src/lib.rs | 1 + zebra-network/src/protocol/external/codec.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/zebra-network/Cargo.toml b/zebra-network/Cargo.toml index db1fab2f16a..3f70284e0f6 100644 --- a/zebra-network/Cargo.toml +++ b/zebra-network/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-network" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-network/src/lib.rs b/zebra-network/src/lib.rs index 82c8ceba11e..d98672518cc 100644 --- a/zebra-network/src/lib.rs +++ b/zebra-network/src/lib.rs @@ -37,6 +37,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] #[macro_use] diff --git a/zebra-network/src/protocol/external/codec.rs b/zebra-network/src/protocol/external/codec.rs index f1c53829d84..36e0a97187f 100644 --- a/zebra-network/src/protocol/external/codec.rs +++ b/zebra-network/src/protocol/external/codec.rs @@ -184,7 +184,7 @@ impl Codec { /// for large data structures like lists, blocks, and transactions. /// See #1774. fn body_length(&self, msg: &Message) -> usize { - let mut writer = FakeWriter { 0: 0 }; + let mut writer = FakeWriter(0); self.write_body(msg, &mut writer) .expect("writer should never fail"); From ee6752e7b7c557844f60081787e095167a124897 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 21:54:52 -0500 Subject: [PATCH 02/12] Rust edition 2021: zebra-chain, cargo fix --edition --- zebra-chain/Cargo.toml | 2 +- zebra-chain/src/lib.rs | 1 + zebra-chain/src/primitives/redpallas/verification_key.rs | 3 +-- zebra-chain/src/value_balance.rs | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/zebra-chain/Cargo.toml b/zebra-chain/Cargo.toml index 45187d9d464..c6c5ecb41f8 100644 --- a/zebra-chain/Cargo.toml +++ b/zebra-chain/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-chain" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-chain/src/lib.rs b/zebra-chain/src/lib.rs index 3bbbb42d2ad..79d6a0056a6 100644 --- a/zebra-chain/src/lib.rs +++ b/zebra-chain/src/lib.rs @@ -10,6 +10,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] // Required by bitvec! macro #![recursion_limit = "256"] diff --git a/zebra-chain/src/primitives/redpallas/verification_key.rs b/zebra-chain/src/primitives/redpallas/verification_key.rs index d1ce26341cc..f8442712313 100644 --- a/zebra-chain/src/primitives/redpallas/verification_key.rs +++ b/zebra-chain/src/primitives/redpallas/verification_key.rs @@ -1,4 +1,4 @@ -use std::{convert::TryFrom, marker::PhantomData}; +use std::marker::PhantomData; use group::{cofactor::CofactorGroup, GroupEncoding}; use halo2::{arithmetic::FieldExt, pasta::pallas}; @@ -95,7 +95,6 @@ impl TryFrom<[u8; 32]> for VerificationKey { type Error = Error; fn try_from(bytes: [u8; 32]) -> Result { - use std::convert::TryInto; VerificationKeyBytes::from(bytes).try_into() } } diff --git a/zebra-chain/src/value_balance.rs b/zebra-chain/src/value_balance.rs index a2716422704..05d53a22637 100644 --- a/zebra-chain/src/value_balance.rs +++ b/zebra-chain/src/value_balance.rs @@ -311,8 +311,6 @@ impl ValueBalance { /// The resulting [`ValueBalance`] will have half of the MAX_MONEY amount on each pool. #[cfg(any(test, feature = "proptest-impl"))] pub fn fake_populated_pool() -> ValueBalance { - use std::convert::TryFrom; - let mut fake_value_pool = ValueBalance::zero(); let fake_transparent_value_balance = From 0d3a5f044b7a5ac40883c8da0f4c7f0d9110706b Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:06:29 -0500 Subject: [PATCH 03/12] Rust edition 2021: tower-batch, cargo fix --edition --- tower-batch/Cargo.toml | 2 +- tower-batch/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tower-batch/Cargo.toml b/tower-batch/Cargo.toml index 9a9fb9dae76..fb6c6474f6a 100644 --- a/tower-batch/Cargo.toml +++ b/tower-batch/Cargo.toml @@ -3,7 +3,7 @@ name = "tower-batch" version = "0.2.19" authors = ["Zcash Foundation "] license = "MIT" -edition = "2018" +edition = "2021" [dependencies] futures = "0.3.19" diff --git a/tower-batch/src/lib.rs b/tower-batch/src/lib.rs index edd8a4315bb..6a6e1b88792 100644 --- a/tower-batch/src/lib.rs +++ b/tower-batch/src/lib.rs @@ -89,6 +89,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] pub mod error; From 0276d315c0d78fe00225dfdef6356728fbc5fce2 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:07:16 -0500 Subject: [PATCH 04/12] Rust edition 2021: tower-fallback, cargo fix --edition --- tower-fallback/Cargo.toml | 2 +- tower-fallback/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tower-fallback/Cargo.toml b/tower-fallback/Cargo.toml index 5fd67c478d6..3c991daa2c7 100644 --- a/tower-fallback/Cargo.toml +++ b/tower-fallback/Cargo.toml @@ -3,7 +3,7 @@ name = "tower-fallback" version = "0.2.15" authors = ["Zcash Foundation "] license = "MIT" -edition = "2018" +edition = "2021" [dependencies] tower = "0.4" diff --git a/tower-fallback/src/lib.rs b/tower-fallback/src/lib.rs index cc73bac1543..2cb4d20eb8a 100644 --- a/tower-fallback/src/lib.rs +++ b/tower-fallback/src/lib.rs @@ -14,6 +14,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] pub mod future; From d3bf9dff5c2ce6bc2f175b732d908f2ea02cc619 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:08:25 -0500 Subject: [PATCH 05/12] Rust edition 2021: zebra-client, cargo fix --edition --- zebra-client/Cargo.toml | 2 +- zebra-client/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-client/Cargo.toml b/zebra-client/Cargo.toml index 4b140fd8bfc..f942ba1c976 100644 --- a/zebra-client/Cargo.toml +++ b/zebra-client/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-client" version = "1.0.0-beta.0" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-client/src/lib.rs b/zebra-client/src/lib.rs index 8a8bd09d0cd..298924110ea 100644 --- a/zebra-client/src/lib.rs +++ b/zebra-client/src/lib.rs @@ -7,4 +7,5 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] From 1e404620ab96cf7c7dcb92b64ae516bc52eb4794 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:19:25 -0500 Subject: [PATCH 06/12] Rust edition 2021: zebra-consensus, cargo fix --edition --- zebra-consensus/Cargo.toml | 2 +- zebra-consensus/src/lib.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/zebra-consensus/Cargo.toml b/zebra-consensus/Cargo.toml index 7ef66447e4b..4f4312588b7 100644 --- a/zebra-consensus/Cargo.toml +++ b/zebra-consensus/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-consensus" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [features] default = [] diff --git a/zebra-consensus/src/lib.rs b/zebra-consensus/src/lib.rs index bab7a166cd9..6d27f6787ea 100644 --- a/zebra-consensus/src/lib.rs +++ b/zebra-consensus/src/lib.rs @@ -38,6 +38,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] mod block; @@ -54,9 +55,7 @@ pub mod chain; pub mod error; pub use block::VerifyBlockError; -pub use checkpoint::VerifyCheckpointError; -pub use checkpoint::MAX_CHECKPOINT_BYTE_COUNT; -pub use checkpoint::MAX_CHECKPOINT_HEIGHT_GAP; +pub use checkpoint::{VerifyCheckpointError, MAX_CHECKPOINT_BYTE_COUNT, MAX_CHECKPOINT_HEIGHT_GAP}; pub use config::Config; pub use error::BlockError; pub use primitives::groth16; From bba8ae23b4c8e6a02f83cc393668d658d3255982 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:20:34 -0500 Subject: [PATCH 07/12] Rust edition 2021: zebra-rpc, cargo fix --edition --- zebra-rpc/Cargo.toml | 2 +- zebra-rpc/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-rpc/Cargo.toml b/zebra-rpc/Cargo.toml index 1f599051f39..e866af9a512 100644 --- a/zebra-rpc/Cargo.toml +++ b/zebra-rpc/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-rpc" version = "1.0.0-beta.0" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-rpc/src/lib.rs b/zebra-rpc/src/lib.rs index a8e35df40a4..02f87917a0d 100644 --- a/zebra-rpc/src/lib.rs +++ b/zebra-rpc/src/lib.rs @@ -7,4 +7,5 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] From b5683c50b37c55f8b81a5a1edad03a00a8fc32f5 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:22:05 -0500 Subject: [PATCH 08/12] Rust edition 2021: zebra-state, cargo fix --edition --- zebra-script/Cargo.toml | 2 +- zebra-script/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-script/Cargo.toml b/zebra-script/Cargo.toml index 1dedcc30848..cf83c01ddd3 100644 --- a/zebra-script/Cargo.toml +++ b/zebra-script/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-script" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-script/src/lib.rs b/zebra-script/src/lib.rs index 0e556fb6eae..effdda7d277 100644 --- a/zebra-script/src/lib.rs +++ b/zebra-script/src/lib.rs @@ -6,6 +6,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] // we allow unsafe code, so we can call zcash_script use std::{convert::TryInto, sync::Arc}; From f96b413ad38c09561a3ba3840a5940751a488382 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:25:04 -0500 Subject: [PATCH 09/12] Rust edition 2021: zebra-state, cargo fix --edition --- zebra-state/Cargo.toml | 2 +- zebra-state/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-state/Cargo.toml b/zebra-state/Cargo.toml index 4290312c54e..92a969dddfa 100644 --- a/zebra-state/Cargo.toml +++ b/zebra-state/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-state" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" [features] proptest-impl = ["proptest", "proptest-derive", "zebra-test"] diff --git a/zebra-state/src/lib.rs b/zebra-state/src/lib.rs index 3621509ff61..c01a633f7ef 100644 --- a/zebra-state/src/lib.rs +++ b/zebra-state/src/lib.rs @@ -15,6 +15,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] #[cfg(any(test, feature = "proptest-impl"))] From c441a5f8a03d897eb1a2c854a0d441cc27bdc9b6 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:26:16 -0500 Subject: [PATCH 10/12] Rust edition 2021: zebra-test, cargo fix --edition --- zebra-test/Cargo.toml | 2 +- zebra-test/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-test/Cargo.toml b/zebra-test/Cargo.toml index 3278bf2b90f..fa21aefac43 100644 --- a/zebra-test/Cargo.toml +++ b/zebra-test/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-test" version = "1.0.0-beta.3" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/zebra-test/src/lib.rs b/zebra-test/src/lib.rs index fb9d0f050a5..b1c30d03e52 100644 --- a/zebra-test/src/lib.rs +++ b/zebra-test/src/lib.rs @@ -6,6 +6,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] // Each lazy_static variable uses additional recursion #![recursion_limit = "512"] From ae0d0da381d75d24501932027943dc19504dc43e Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:29:00 -0500 Subject: [PATCH 11/12] Rust edition 2021: zebra-utils, cargo fix --edition --- zebra-utils/Cargo.toml | 2 +- zebra-utils/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebra-utils/Cargo.toml b/zebra-utils/Cargo.toml index e63426cd0ab..3a472f738ce 100644 --- a/zebra-utils/Cargo.toml +++ b/zebra-utils/Cargo.toml @@ -3,7 +3,7 @@ name = "zebra-utils" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" version = "1.0.0-beta.3" -edition = "2018" +edition = "2021" # Prevent accidental publication of this utility crate. publish = false diff --git a/zebra-utils/src/lib.rs b/zebra-utils/src/lib.rs index 9d0c1a42a67..d619fb0df66 100644 --- a/zebra-utils/src/lib.rs +++ b/zebra-utils/src/lib.rs @@ -8,4 +8,5 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] From 240bfce7626078db6e27c2317f2c86fb370fd140 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 11 Jan 2022 22:32:17 -0500 Subject: [PATCH 12/12] Rust edition 2021: zebrad, cargo fix --edition --- zebrad/Cargo.toml | 2 +- zebrad/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index 6c47f503915..35e4ba7ee8e 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -3,7 +3,7 @@ name = "zebrad" authors = ["Zcash Foundation "] license = "MIT OR Apache-2.0" version = "1.0.0-beta.3" -edition = "2018" +edition = "2021" repository = "https://github.com/ZcashFoundation/zebra" # make `cargo run` use `zebrad` by default # when run in the workspace directory diff --git a/zebrad/src/lib.rs b/zebrad/src/lib.rs index ab9ec41b8d4..cfa4ac629ca 100644 --- a/zebrad/src/lib.rs +++ b/zebrad/src/lib.rs @@ -21,6 +21,7 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] #![deny(clippy::await_holding_lock)] +#![deny(rust_2021_compatibility)] #![forbid(unsafe_code)] // Tracing causes false positives on this lint: // https://github.com/tokio-rs/tracing/issues/553