Make crate level attributes uniform

Make the trait level attributes uniform across all released crates in
the repo. Excludes things that are obviously not needed, eg, bench stuff
if there is not bench code.

- Remove `uninhabited_references` - this is allow by default now.
- Remove `unconditional_recursion` and mark the single false positive we
  have with an `allow`.

Note, this does not add `missing_docs` to the `io` crate. There is an
open PR at the moment to add that along with the required docs.
This commit is contained in:
Tobin C. Harding 2024-01-25 17:41:01 +11:00
parent 34c4039963
commit ba1166a63b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
5 changed files with 36 additions and 19 deletions

View File

@ -29,18 +29,20 @@
//! happen the implementations diverge one day.
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
// Experimental features we need.
#![cfg_attr(bench, feature(test))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Coding conventions
#![cfg_attr(bench, feature(test))]
// Coding conventions.
#![warn(missing_docs)]
// Instead of littering the codebase for non-fuzzing code just globally allow.
#![cfg_attr(fuzzing, allow(dead_code, unused_imports))]
// Exclude clippy 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::uninhabited_references)] // falsely claims that 100% safe code is UB
#![allow(clippy::manual_range_contains)] // more readable than clippy's format
#![allow(clippy::unconditional_recursion)] // broken; see https://github.com/rust-lang/rust-clippy/issues/12133
#![allow(clippy::manual_range_contains)] // More readable than clippy's format.
// Disable 16-bit support at least for now as we can't guarantee it yet.
#[cfg(target_pointer_width = "16")]

View File

@ -65,21 +65,21 @@
//! # fn main() {}
//! ```
// Coding conventions
#![warn(missing_docs)]
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
// Experimental features we need.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![cfg_attr(bench, feature(test))]
// In general, rust is absolutely horrid at supporting users doing things like,
// for example, compiling Rust code for real environments. Disable useless lints
// that don't do anything but annoy us and cant actually ever be resolved.
#![allow(bare_trait_objects)]
#![allow(ellipsis_inclusive_range_patterns)]
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
// Coding conventions.
#![warn(missing_docs)]
// Instead of littering the codebase for non-fuzzing code just globally allow.
#![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))]
// Exclude clippy 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::manual_range_contains)] // More readable than clippy's format.
#[cfg(all(feature = "alloc", not(feature = "std")))]
extern crate alloc;

View File

@ -7,12 +7,16 @@
//!
#![no_std]
// Experimental features we need.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Coding conventions
// Coding conventions.
#![warn(missing_docs)]
// Exclude clippy 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::manual_range_contains)] // More readable than clippy's format.
#[cfg(feature = "alloc")]
extern crate alloc;

View File

@ -9,9 +9,17 @@
//! `std::io`'s traits without unnecessary complexity.
#![cfg_attr(not(feature = "std"), no_std)]
// Experimental features we need.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Coding conventions.
// #![warn(missing_docs)]
// Exclude lints we don't think are valuable.
#![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.
#[cfg(any(feature = "alloc", feature = "std"))]
extern crate alloc;

View File

@ -6,10 +6,13 @@
// Experimental features we need.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Coding conventions
// Coding conventions.
#![warn(missing_docs)]
// Exclude clippy 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::manual_range_contains)] // More readable than clippy's format.
#![no_std]