Skip to content

Commit

Permalink
clippy be quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed May 28, 2024
1 parent 8461fdb commit 8251252
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/allocation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg(feature = "extern_crate_alloc")]
#![allow(clippy::duplicated_attributes)]

//! Stuff to boost things in the `alloc` crate.
//!
Expand Down
21 changes: 12 additions & 9 deletions src/anybitpattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::{Pod, Zeroable};

/// Marker trait for "plain old data" types that are valid for any bit pattern.
///
/// The requirements for this is very similar to [`Pod`],
/// except that the type can allow uninit (or padding) bytes.
/// This limits what you can do with a type of this kind, but also broadens the
/// included types to `repr(C)` `struct`s that contain padding as well as
/// `union`s. Notably, you can only cast *immutable* references and *owned*
/// values into [`AnyBitPattern`] types, not *mutable* references.
/// The requirements for this is very similar to [`Pod`], except that the type
/// can allow uninit (or padding) bytes. This limits what you can do with a type
/// of this kind, but also broadens the included types to `repr(C)` `struct`s
/// that contain padding as well as `union`s. Notably, you can only cast
/// *immutable* references and *owned* values into [`AnyBitPattern`] types, not
/// *mutable* references.
///
/// [`Pod`] is a subset of [`AnyBitPattern`], meaning that any `T: Pod` is also
/// [`AnyBitPattern`] but any `T: AnyBitPattern` is not necessarily [`Pod`].
Expand All @@ -26,8 +26,8 @@ use crate::{Pod, Zeroable};
/// below safety rules.
///
/// * *NOTE: even `C-style`, fieldless enums are intentionally **excluded** from
/// this trait, since it is **unsound** for an enum to have a discriminant value
/// that is not one of its defined variants.
/// this trait, since it is **unsound** for an enum to have a discriminant
/// value that is not one of its defined variants.
///
/// # Safety
///
Expand Down Expand Up @@ -56,6 +56,9 @@ pub unsafe trait AnyBitPattern:
unsafe impl<T: Pod> AnyBitPattern for T {}

#[cfg(feature = "zeroable_maybe_uninit")]
#[cfg_attr(feature = "nightly_docs", doc(cfg(feature = "zeroable_maybe_uninit")))]
#[cfg_attr(
feature = "nightly_docs",
doc(cfg(feature = "zeroable_maybe_uninit"))
)]
unsafe impl<T> AnyBitPattern for core::mem::MaybeUninit<T> where T: AnyBitPattern
{}
1 change: 1 addition & 0 deletions src/checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ unsafe impl CheckedBitPattern for bool {

#[inline]
fn is_valid_bit_pattern(bits: &Self::Bits) -> bool {
// DO NOT use the `matches!` macro, it isn't 1.34 compatible.
match *bits {
0 | 1 => true,
_ => false,
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#![warn(missing_docs)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::result_unit_err)]
#![allow(clippy::type_complexity)]
#![cfg_attr(feature = "nightly_docs", feature(doc_cfg))]
#![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))]
#![cfg_attr(
Expand Down

0 comments on commit 8251252

Please sign in to comment.