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 | 10 ++++++++-- zebrad/tests/acceptance.rs | 6 ++++++ 7 files changed, 44 insertions(+), 2 deletions(-) diff --git a/zebra-chain/src/lib.rs b/zebra-chain/src/lib.rs index 5a317df4c67..d11235520c1 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 37bf747a722..798be109138 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 d6dca394c59..7bce06115a5 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 1bdb9d68a80..8254c8b301a 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 635e72d1640..f6be61421fd 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 e16cfb50db3..ba58b02689e 100644 --- a/zebra-test/src/lib.rs +++ b/zebra-test/src/lib.rs @@ -1,10 +1,16 @@ //! Miscellaneous test code for Zebra. +// 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)] -// Each lazy_static variable uses additional recursion -#![recursion_limit = "256"] use color_eyre::section::PanicMessage; use owo_colors::OwoColorize; diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 66759125ffe..82717f22c97 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;