fix(clippy): Fix clippy and rustfmt after last releases today (#7381)

* fix clippy and rustfmt after last releases today

* Ignore clippy::arc_with_non_send_sync false positives in proptest code only

* Remove .cargo/config.toml changes that didn't work

---------

Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
Alfredo Garcia 2023-08-25 01:08:13 -03:00 committed by GitHub
parent e86197f6be
commit 000c7b4bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 2 deletions

View File

@ -8,6 +8,16 @@
#![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_chain")]
// Required by bitvec! macro
#![recursion_limit = "256"]
//
// Rust 1.72 has a false positive when nested generics are used inside Arc.
// This makes the `arc_with_non_send_sync` lint trigger on a lot of proptest code.
//
// TODO: remove this allow when Rust 1.73 is stable, because this lint bug is fixed in that release:
// <https://github.com/rust-lang/rust-clippy/issues/11076>
#![cfg_attr(
any(test, feature = "proptest-impl"),
allow(clippy::arc_with_non_send_sync)
)]
#[macro_use]
extern crate bitflags;

View File

@ -33,6 +33,16 @@
#![doc(html_favicon_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-favicon-128.png")]
#![doc(html_logo_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-icon.png")]
#![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_consensus")]
//
// Rust 1.72 has a false positive when nested generics are used inside Arc.
// This makes the `arc_with_non_send_sync` lint trigger on a lot of proptest code.
//
// TODO: remove this allow when Rust 1.73 is stable, because this lint bug is fixed in that release:
// <https://github.com/rust-lang/rust-clippy/issues/11076>
#![cfg_attr(
any(test, feature = "proptest-impl"),
allow(clippy::arc_with_non_send_sync)
)]
mod block;
mod checkpoint;

View File

@ -354,7 +354,7 @@ impl AddressBook {
/// See [`AddressBook::is_ready_for_connection_attempt_with_ip`] for more details.
fn should_update_most_recent_by_ip(&self, updated: MetaAddr) -> bool {
let Some(most_recent_by_ip) = self.most_recent_by_ip.as_ref() else {
return false
return false;
};
if let Some(previous) = most_recent_by_ip.get(&updated.addr.ip()) {
@ -369,7 +369,7 @@ impl AddressBook {
/// The entry is checked for an exact match to the IP and port of `addr`.
fn should_remove_most_recent_by_ip(&self, addr: PeerSocketAddr) -> bool {
let Some(most_recent_by_ip) = self.most_recent_by_ip.as_ref() else {
return false
return false;
};
if let Some(previous) = most_recent_by_ip.get(&addr.ip()) {

View File

@ -132,6 +132,16 @@
#![doc(html_favicon_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-favicon-128.png")]
#![doc(html_logo_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-icon.png")]
#![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_network")]
//
// Rust 1.72 has a false positive when nested generics are used inside Arc.
// This makes the `arc_with_non_send_sync` lint trigger on a lot of proptest code.
//
// TODO: remove this allow when Rust 1.73 is stable, because this lint bug is fixed in that release:
// <https://github.com/rust-lang/rust-clippy/issues/11076>
#![cfg_attr(
any(test, feature = "proptest-impl"),
allow(clippy::arc_with_non_send_sync)
)]
#[macro_use]
extern crate pin_project;

View File

@ -11,6 +11,16 @@
#![doc(html_favicon_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-favicon-128.png")]
#![doc(html_logo_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-icon.png")]
#![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_state")]
//
// Rust 1.72 has a false positive when nested generics are used inside Arc.
// This makes the `arc_with_non_send_sync` lint trigger on a lot of proptest code.
//
// TODO: remove this allow when Rust 1.73 is stable, because this lint bug is fixed in that release:
// <https://github.com/rust-lang/rust-clippy/issues/11076>
#![cfg_attr(
any(test, feature = "proptest-impl"),
allow(clippy::arc_with_non_send_sync)
)]
#[macro_use]
extern crate tracing;

View File

@ -1,2 +1,4 @@
//! Tests for state ChainTip traits and types.
mod prop;
mod vectors;

View File

@ -100,6 +100,16 @@
// Tracing causes false positives on this lint:
// https://github.com/tokio-rs/tracing/issues/553
#![allow(clippy::cognitive_complexity)]
//
// Rust 1.72 has a false positive when nested generics are used inside Arc.
// This makes the `arc_with_non_send_sync` lint trigger on a lot of proptest code.
//
// TODO: remove this allow when Rust 1.73 is stable, because this lint bug is fixed in that release:
// <https://github.com/rust-lang/rust-clippy/issues/11076>
#![cfg_attr(
any(test, feature = "proptest-impl"),
allow(clippy::arc_with_non_send_sync)
)]
#[macro_use]
extern crate tracing;