From 258789ed9b0486dce23662253d921665db22cc78 Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 18 Jan 2021 14:31:01 +1000 Subject: [PATCH] Use the rustc unknown lints attribute The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to add the canonical name, so we can continue to build without warnings on nightly. But we also need to keep the old name, so we can continue to build without warnings on stable. And therefore, we also need to disable the "removed lints" warning, otherwise we'll get warnings about the old name on nightly. We'll need to keep this transitional clippy config until rustc 1.51 is stable. --- zebra-chain/src/lib.rs | 6 ++++++ zebra-consensus/src/lib.rs | 6 ++++++ zebra-network/src/lib.rs | 6 ++++++ zebra-script/src/lib.rs | 6 ++++++ zebra-state/src/lib.rs | 6 ++++++ zebra-test/src/lib.rs | 12 +++++++++--- zebrad/tests/acceptance.rs | 6 ++++++ 7 files changed, 45 insertions(+), 3 deletions(-) diff --git a/zebra-chain/src/lib.rs b/zebra-chain/src/lib.rs index 5a317df4..d1123552 100644 --- a/zebra-chain/src/lib.rs +++ b/zebra-chain/src/lib.rs @@ -9,7 +9,13 @@ // #![deny(missing_docs)] #![allow(clippy::try_err)] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::from_iter_instead_of_collect)] #![allow(clippy::unnecessary_wraps)] diff --git a/zebra-consensus/src/lib.rs b/zebra-consensus/src/lib.rs index 37bf747a..798be109 100644 --- a/zebra-consensus/src/lib.rs +++ b/zebra-consensus/src/lib.rs @@ -37,7 +37,13 @@ //#![deny(missing_docs)] #![allow(clippy::try_err)] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::unnecessary_wraps)] mod block; diff --git a/zebra-network/src/lib.rs b/zebra-network/src/lib.rs index d6dca394..7bce0611 100644 --- a/zebra-network/src/lib.rs +++ b/zebra-network/src/lib.rs @@ -39,7 +39,13 @@ // https://github.com/tokio-rs/tracing/issues/553 #![allow(clippy::cognitive_complexity)] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::unnecessary_wraps)] #[macro_use] diff --git a/zebra-script/src/lib.rs b/zebra-script/src/lib.rs index 1bdb9d68..8254c8b3 100644 --- a/zebra-script/src/lib.rs +++ b/zebra-script/src/lib.rs @@ -3,7 +3,13 @@ #![doc(html_logo_url = "https://www.zfnd.org/images/zebra-icon.png")] #![doc(html_root_url = "https://doc.zebra.zfnd.org/zebra_script")] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::unnecessary_wraps)] use displaydoc::Display; diff --git a/zebra-state/src/lib.rs b/zebra-state/src/lib.rs index 635e72d1..f6be6142 100644 --- a/zebra-state/src/lib.rs +++ b/zebra-state/src/lib.rs @@ -6,7 +6,13 @@ #![warn(missing_docs)] #![allow(clippy::try_err)] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::field_reassign_with_default)] #![allow(clippy::unnecessary_wraps)] diff --git a/zebra-test/src/lib.rs b/zebra-test/src/lib.rs index e16cfb50..ba58b026 100644 --- a/zebra-test/src/lib.rs +++ b/zebra-test/src/lib.rs @@ -1,10 +1,16 @@ //! Miscellaneous test code for Zebra. -// Disable some broken or unwanted clippy nightly lints -#![allow(clippy::unknown_clippy_lints)] -#![allow(clippy::from_iter_instead_of_collect)] // Each lazy_static variable uses additional recursion #![recursion_limit = "256"] +// Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable +#![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable +#![allow(clippy::from_iter_instead_of_collect)] use color_eyre::section::PanicMessage; use owo_colors::OwoColorize; diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 66759125..82717f22 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -16,7 +16,13 @@ #![allow(dead_code)] #![allow(clippy::try_err)] // Disable some broken or unwanted clippy nightly lints +// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later +#![allow(unknown_lints)] +// Disable old lint warnings on nightly until 1.51 is stable +#![allow(renamed_and_removed_lints)] +// Use the old lint name to build without warnings on stable until 1.51 is stable #![allow(clippy::unknown_clippy_lints)] +// The actual lints we want to disable #![allow(clippy::field_reassign_with_default)] use color_eyre::eyre::Result;