Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Rust edition 2021 #3332

Merged
merged 17 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tower-batch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tower-batch"
version = "0.2.19"
authors = ["Zcash Foundation <[email protected]>"]
license = "MIT"
edition = "2018"
edition = "2021"

[dependencies]
futures = "0.3.19"
Expand Down
1 change: 1 addition & 0 deletions tower-batch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tower-fallback/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tower-fallback"
version = "0.2.15"
authors = ["Zcash Foundation <[email protected]>"]
license = "MIT"
edition = "2018"
edition = "2021"

[dependencies]
tower = "0.4"
Expand Down
1 change: 1 addition & 0 deletions tower-fallback/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-chain"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 1 addition & 2 deletions zebra-chain/src/primitives/redpallas/verification_key.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -95,7 +95,6 @@ impl<T: SigType> TryFrom<[u8; 32]> for VerificationKey<T> {
type Error = Error;

fn try_from(bytes: [u8; 32]) -> Result<Self, Self::Error> {
use std::convert::TryInto;
VerificationKeyBytes::from(bytes).try_into()
}
}
Expand Down
2 changes: 0 additions & 2 deletions zebra-chain/src/value_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ impl ValueBalance<NonNegative> {
/// 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<NonNegative> {
use std::convert::TryFrom;

let mut fake_value_pool = ValueBalance::zero();

let fake_transparent_value_balance =
Expand Down
2 changes: 1 addition & 1 deletion zebra-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-client"
version = "1.0.0-beta.0"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
#![warn(missing_docs)]
#![allow(clippy::try_err)]
#![deny(clippy::await_holding_lock)]
#![deny(rust_2021_compatibility)]
#![forbid(unsafe_code)]
2 changes: 1 addition & 1 deletion zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-consensus"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
license = "MIT OR Apache-2.0"
edition = "2018"
edition = "2021"

[features]
default = []
Expand Down
5 changes: 2 additions & 3 deletions zebra-consensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion zebra-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-network"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion zebra-network/src/protocol/external/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion zebra-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-rpc"
version = "1.0.0-beta.0"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
#![warn(missing_docs)]
#![allow(clippy::try_err)]
#![deny(clippy::await_holding_lock)]
#![deny(rust_2021_compatibility)]
#![forbid(unsafe_code)]
2 changes: 1 addition & 1 deletion zebra-script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-script"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-script/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion zebra-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-state"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
license = "MIT OR Apache-2.0"
edition = "2018"
edition = "2021"

[features]
proptest-impl = ["proptest", "proptest-derive", "zebra-test"]
Expand Down
1 change: 1 addition & 0 deletions zebra-state/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down
2 changes: 1 addition & 1 deletion zebra-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-test"
version = "1.0.0-beta.3"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion zebra-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebra-utils"
authors = ["Zcash Foundation <[email protected]>"]
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

Expand Down
1 change: 1 addition & 0 deletions zebra-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
#![warn(missing_docs)]
#![allow(clippy::try_err)]
#![deny(clippy::await_holding_lock)]
#![deny(rust_2021_compatibility)]
#![forbid(unsafe_code)]
2 changes: 1 addition & 1 deletion zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "zebrad"
authors = ["Zcash Foundation <[email protected]>"]
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
Expand Down
1 change: 1 addition & 0 deletions zebrad/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down