Skip to content

Commit

Permalink
Clean up one TODO, enable more Clippy lints (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlf committed May 23, 2023
1 parent 59e60d3 commit 27aea67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
clippy::decimal_literal_representation,
clippy::get_unwrap,
clippy::indexing_slicing,
clippy::missing_safety_doc,
clippy::obfuscated_if_else,
clippy::perf,
clippy::print_stdout,
Expand Down Expand Up @@ -901,19 +902,15 @@ safety_comment! {

safety_comment! {
/// SAFETY:
/// The reference [1] suggests (but does not clearly promise) that
/// `PhantomData` has size 0 and alignment 1.
/// For all `T`, `PhantomData<T>` has size 0 and alignment 1. [1]
/// - `FromZeroes`, `FromBytes`: There is only one possible sequence of 0
/// bytes, and `PhantomData` is inhabited.
/// - `AsBytes`: Since `PhantomData` has size 0, it contains no padding
/// bytes.
/// - `Unaligned`: Per the preceding reference, `PhantomData` has alignment
/// 1.
///
/// [1] https://doc.rust-lang.org/reference/type-layout.html#the-transparent-representation
///
/// TODO(https://github.com/rust-lang/rust/pull/104081): Cite guaranteed
/// size and alignment.
/// [1] https://doc.rust-lang.org/std/marker/struct.PhantomData.html#layout-1
unsafe_impl!(T: ?Sized => FromZeroes for PhantomData<T>);
unsafe_impl!(T: ?Sized => FromBytes for PhantomData<T>);
unsafe_impl!(T: ?Sized => AsBytes for PhantomData<T>);
Expand Down
2 changes: 1 addition & 1 deletion zerocopy-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// our MSRV.
#![allow(unknown_lints)]
#![deny(renamed_and_removed_lints)]
#![deny(clippy::all)]
#![deny(clippy::all, clippy::missing_safety_doc)]
#![deny(
rustdoc::bare_urls,
rustdoc::broken_intra_doc_links,
Expand Down

0 comments on commit 27aea67

Please sign in to comment.