Skip to content

Commit

Permalink
Merge pull request #81 from waywardmonkeys/needless-doctest-main-warn…
Browse files Browse the repository at this point in the history
…ings

clippy: Fix `needless-doctest-main` lints.
  • Loading branch information
RalfJung authored Nov 13, 2023
2 parents 62ca3fa + be84d6f commit 2d22f1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
//! a: u32
//! }
//!
//! fn main() {
//! assert_eq!(offset_of!(HelpMeIAmTrappedInAStructFactory, a), 15);
//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, a), 15..19);
//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, help_me_before_they_ .. a), 0..15);
//! }
//! assert_eq!(offset_of!(HelpMeIAmTrappedInAStructFactory, a), 15);
//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, a), 15..19);
//! assert_eq!(span_of!(HelpMeIAmTrappedInAStructFactory, help_me_before_they_ .. a), 0..15);
//! ```
//!
//! This functionality can be useful, for example, for checksum calculations:
Expand Down
14 changes: 4 additions & 10 deletions src/offset_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ macro_rules! _memoffset__offset_of_impl {
/// c: [u8; 5]
/// }
///
/// fn main() {
/// assert_eq!(offset_of!(Foo, a), 0);
/// assert_eq!(offset_of!(Foo, b), 4);
/// }
/// assert_eq!(offset_of!(Foo, a), 0);
/// assert_eq!(offset_of!(Foo, b), 4);
/// ```
///
/// ## Notes
Expand All @@ -133,9 +131,7 @@ macro_rules! offset_of {
/// ```
/// use memoffset::offset_of_tuple;
///
/// fn main() {
/// assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout");
/// }
/// assert!(offset_of_tuple!((u8, u32), 1) >= 0, "Tuples do not have a defined layout");
/// ```
#[cfg(tuple_ty)]
#[macro_export(local_inner_macros)]
Expand Down Expand Up @@ -186,9 +182,7 @@ macro_rules! _memoffset__offset_of_union_impl {
/// foo64: i64,
/// }
///
/// fn main() {
/// assert!(offset_of_union!(Foo, foo64) == 0);
/// }
/// assert!(offset_of_union!(Foo, foo64) == 0);
/// ```
///
/// ## Note
Expand Down
16 changes: 7 additions & 9 deletions src/span_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ macro_rules! _memoffset__compile_error {
/// egg: [[u8; 4]; 4]
/// }
///
/// fn main() {
/// assert_eq!(0..84, span_of!(Blarg, ..));
/// assert_eq!(0..8, span_of!(Blarg, .. y));
/// assert_eq!(0..64, span_of!(Blarg, ..= y));
/// assert_eq!(0..8, span_of!(Blarg, x));
/// assert_eq!(8..84, span_of!(Blarg, y ..));
/// assert_eq!(0..8, span_of!(Blarg, x .. y));
/// assert_eq!(0..64, span_of!(Blarg, x ..= y));
/// }
/// assert_eq!(0..84, span_of!(Blarg, ..));
/// assert_eq!(0..8, span_of!(Blarg, .. y));
/// assert_eq!(0..64, span_of!(Blarg, ..= y));
/// assert_eq!(0..8, span_of!(Blarg, x));
/// assert_eq!(8..84, span_of!(Blarg, y ..));
/// assert_eq!(0..8, span_of!(Blarg, x .. y));
/// assert_eq!(0..64, span_of!(Blarg, x ..= y));
/// ```
#[macro_export(local_inner_macros)]
macro_rules! span_of {
Expand Down

0 comments on commit 2d22f1c

Please sign in to comment.