diff --git a/src/byteorder.rs b/src/byteorder.rs index 82d7cd30d32..b898096d587 100644 --- a/src/byteorder.rs +++ b/src/byteorder.rs @@ -61,6 +61,8 @@ //! } //! ``` +#![forbid(clippy::missing_safety_doc, clippy::undocumented_unsafe_blocks)] + use core::{ convert::{TryFrom, TryInto}, fmt::{self, Binary, Debug, Display, Formatter, LowerHex, Octal, UpperHex}, diff --git a/src/derive_util.rs b/src/derive_util.rs index 8f72ef09c6d..abda473eff0 100644 --- a/src/derive_util.rs +++ b/src/derive_util.rs @@ -12,6 +12,7 @@ //! different times). #![allow(missing_debug_implementations)] +#![forbid(clippy::missing_safety_doc, clippy::undocumented_unsafe_blocks)] use core::marker::PhantomData; diff --git a/src/lib.rs b/src/lib.rs index a0246ccc70a..17ef49bdab5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1111,6 +1111,8 @@ safety_comment! { // [2] https://github.com/rust-lang/unsafe-code-guidelines/issues/38 #[cfg(feature = "simd")] mod simd { + #![forbid(clippy::missing_safety_doc, clippy::undocumented_unsafe_blocks)] + /// Defines a module which implements `FromZeroes`, `FromBytes`, and /// `AsBytes` for a set of types from a module in `core::arch`. /// @@ -2786,6 +2788,8 @@ unsafe impl<'a> ByteSliceMut for RefMut<'a, [u8]> {} #[cfg(feature = "alloc")] mod alloc_support { + #![forbid(clippy::missing_safety_doc, clippy::undocumented_unsafe_blocks)] + use alloc::vec::Vec; use super::*; diff --git a/zerocopy-derive/src/lib.rs b/zerocopy-derive/src/lib.rs index 8e1b9801998..43aaca6baba 100644 --- a/zerocopy-derive/src/lib.rs +++ b/zerocopy-derive/src/lib.rs @@ -12,7 +12,8 @@ // our MSRV. #![allow(unknown_lints)] #![deny(renamed_and_removed_lints)] -#![deny(clippy::all, clippy::missing_safety_doc)] +#![deny(clippy::all)] +#![forbid(clippy::missing_safety_doc, clippy::undocumented_unsafe_blocks)] #![deny( rustdoc::bare_urls, rustdoc::broken_intra_doc_links, diff --git a/zerocopy-derive/src/repr.rs b/zerocopy-derive/src/repr.rs index 5bd4a8a9115..5997ad2f2ff 100644 --- a/zerocopy-derive/src/repr.rs +++ b/zerocopy-derive/src/repr.rs @@ -73,9 +73,7 @@ impl Config { } let initial_sp = metas[0].span(); - let err_span = metas.iter().skip(1).fold(Some(initial_sp), |sp_option, meta| { - sp_option.and_then(|sp| sp.join(meta.span())) - }); + let err_span = metas.iter().skip(1).try_fold(initial_sp, |sp, meta| sp.join(meta.span())); if self.allowed_combinations.contains(&reprs.as_slice()) { Ok(reprs)