Merge rust-bitcoin/rust-bitcoin#3310: Shoosh linter in bench build
fe46225ed0
Allow unused imports when running bench code (Tobin C. Harding)eb67e873e0
Allow unused variables in release mode (Tobin C. Harding) Pull request description: Two patches to clear the million warnings when running the bench code. ACKs for top commit: apoelstra: ACKfe46225ed0
successfully ran local tests; though in the first commit you could also use `cfg_attr` FWIW Kixunil: ACKfe46225ed0
Tree-SHA512: 3f705e0441d8c0e41e9ceb5473572810ff2513f7e5531c1b7889418a3a85ac8622e50e271c7a3b5c386fb3f5629b85d4bd79739c4a02b51d58da86890721d8d2
This commit is contained in:
commit
9797e50ab5
|
@ -12,8 +12,9 @@
|
||||||
#![cfg_attr(bench, feature(test))]
|
#![cfg_attr(bench, feature(test))]
|
||||||
// Coding conventions.
|
// Coding conventions.
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
// Instead of littering the codebase for non-fuzzing code just globally allow.
|
// Instead of littering the codebase for non-fuzzing and bench code just globally allow.
|
||||||
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
|
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
|
||||||
|
#![cfg_attr(bench, allow(dead_code, unused_imports))]
|
||||||
// Exclude lints we don't think are valuable.
|
// Exclude lints we don't think are valuable.
|
||||||
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
||||||
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
||||||
|
|
|
@ -159,6 +159,7 @@ struct DisplayWrapper<'a, T: 'a + Encodable, E>(&'a T, PhantomData<E>);
|
||||||
impl<'a, T: 'a + Encodable, E: ByteEncoder> fmt::Display for DisplayWrapper<'a, T, E> {
|
impl<'a, T: 'a + Encodable, E: ByteEncoder> fmt::Display for DisplayWrapper<'a, T, E> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut writer = IoWrapper::<'_, _, E::Encoder>::new(f, E::default().into());
|
let mut writer = IoWrapper::<'_, _, E::Encoder>::new(f, E::default().into());
|
||||||
|
#[allow(unused_variables)] // When debug_assertions are not enabled.
|
||||||
self.0.consensus_encode(&mut writer).map_err(|error| {
|
self.0.consensus_encode(&mut writer).map_err(|error| {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
|
@ -199,6 +200,7 @@ impl<W: fmt::Write> ErrorTrackingWriter<W> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
|
#[allow(unused_variables)] // When debug_assertions are not enabled.
|
||||||
fn assert_no_error(&self, fun: &str) {
|
fn assert_no_error(&self, fun: &str) {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
|
@ -217,6 +219,7 @@ impl<W: fmt::Write> ErrorTrackingWriter<W> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables)] // When debug_assertions are not enabled.
|
||||||
fn set_error(&mut self, was: bool) {
|
fn set_error(&mut self, was: bool) {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,8 +30,9 @@
|
||||||
#![cfg_attr(bench, feature(test))]
|
#![cfg_attr(bench, feature(test))]
|
||||||
// Coding conventions.
|
// Coding conventions.
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
// Instead of littering the codebase for non-fuzzing code just globally allow.
|
// Instead of littering the codebase for non-fuzzing and bench code just globally allow.
|
||||||
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
|
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
|
||||||
|
#![cfg_attr(bench, allow(dead_code, unused_imports))]
|
||||||
// Exclude lints we don't think are valuable.
|
// Exclude lints we don't think are valuable.
|
||||||
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
||||||
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
||||||
|
|
|
@ -68,8 +68,9 @@
|
||||||
#![cfg_attr(bench, feature(test))]
|
#![cfg_attr(bench, feature(test))]
|
||||||
// Coding conventions.
|
// Coding conventions.
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
// Instead of littering the codebase for non-fuzzing code just globally allow.
|
// Instead of littering the codebase for non-fuzzing and bench code just globally allow.
|
||||||
#![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))]
|
#![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))]
|
||||||
|
#![cfg_attr(bench, allow(dead_code, unused_imports))]
|
||||||
// Exclude lints we don't think are valuable.
|
// Exclude lints we don't think are valuable.
|
||||||
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
||||||
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
|
||||||
|
|
Loading…
Reference in New Issue