Merge rust-bitcoin/rust-bitcoin#2134: Add clippy exceptions for needless_question_mark lint

875545517d Add clippy exceptions for needless_question_mark lint (Steven Roose)

Pull request description:

  This lint forces you to write semantically different code that is in most cases inferior, just to save you 5 characters.

  The reason why the code is inferior is because it doesn't do error conversion so it would break when either of the two function signatures changes while in the original code using the `?` operator, nothing would break if the inner error can be converted into the outer error.

ACKs for top commit:
  apoelstra:
    ACK 875545517d
  tcharding:
    ACK 875545517d

Tree-SHA512: 8429e0fb7d759a3d19231e7bcaed61b0988172d931e758a9522d7c994854fd403408bb93b06778a5c09746cd38b6a96d3d2e0a862fb4516f2dbfffffe8735ce0
This commit is contained in:
Andrew Poelstra 2023-10-24 00:28:18 +00:00
commit 1eb6e0c7d8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,8 @@
#![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 code just globally allow.
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))] #![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
// Exclude clippy lints we don't think are valuable
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
#[cfg(not(any(feature = "std", feature = "no-std")))] #[cfg(not(any(feature = "std", feature = "no-std")))]
compile_error!("at least one of the `std` or `no-std` features must be enabled"); compile_error!("at least one of the `std` or `no-std` features must be enabled");

View File

@ -78,6 +78,8 @@
#![cfg_attr(all(not(test), not(feature = "std")), no_std)] #![cfg_attr(all(not(test), not(feature = "std")), no_std)]
// Instead of littering the codebase for non-fuzzing code just globally allow. // Instead of littering the codebase for non-fuzzing code just globally allow.
#![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))] #![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))]
// Exclude clippy lints we don't think are valuable
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
#[cfg(all(not(test), not(feature = "std"), feature = "core2"))] #[cfg(all(not(test), not(feature = "std"), feature = "core2"))]
extern crate actual_core2 as core2; extern crate actual_core2 as core2;

View File

@ -11,6 +11,8 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Coding conventions // Coding conventions
#![warn(missing_docs)] #![warn(missing_docs)]
// Exclude clippy lints we don't think are valuable
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
extern crate alloc; extern crate alloc;