Skip to content

Commit

Permalink
Work around dead_code warning in tests
Browse files Browse the repository at this point in the history
    warning: field `0` is never read
     --> tests/helper/lib.rs:5:19
      |
    5 | pub struct Struct(str);
      |            ------ ^^^
      |            |
      |            field in this struct
      |
      = note: `#[warn(dead_code)]` on by default
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
      |
    5 | pub struct Struct(());
      |                   ~~

    warning: field `0` is never read
     --> tests/test_custom.rs:7:23
      |
    7 |     pub struct Custom(str);
      |                ------ ^^^
      |                |
      |                field in this struct
      |
      = note: `#[warn(dead_code)]` on by default
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
      |
    7 |     pub struct Custom(());
      |                       ~~
  • Loading branch information
dtolnay committed Jan 6, 2024
1 parent ff588c7 commit 5f45087
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ use ref_cast::RefCastCustom;

#[derive(RefCastCustom)]
#[repr(transparent)]
pub struct Struct(str);
pub struct Struct(#[allow(dead_code)] str);
2 changes: 1 addition & 1 deletion tests/test_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod forbid_unsafe {

#[derive(RefCastCustom)]
#[repr(transparent)]
pub struct Custom(str);
pub struct Custom(#[allow(dead_code)] str);

impl Custom {
#[ref_cast_custom]
Expand Down

0 comments on commit 5f45087

Please sign in to comment.