Skip to content

Commit

Permalink
Ignore dead code lint in tests
Browse files Browse the repository at this point in the history
New in nightly-2024-03-24 from rust-lang/rust#119552.

    warning: field `x` is never read
      --> tests/regression/issue795.rs:11:15
       |
    11 |     Variant { x: u8 },
       |     -------   ^
       |     |
       |     field in this variant
       |
       = note: `#[warn(dead_code)]` on by default

    warning: field `i` is never read
      --> tests/regression/issue845.rs:63:9
       |
    61 | pub struct Struct {
       |            ------ field in this struct
    62 |     #[serde(deserialize_with = "deserialize_integer_or_string")]
    63 |     pub i: i64,
       |         ^
       |
       = note: `Struct` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  • Loading branch information
dtolnay committed Mar 24, 2024
1 parent 8e7b37b commit d2dbbf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/regression/issue795.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use std::fmt;

#[derive(Debug)]
pub enum Enum {
Variant { x: u8 },
Variant {
#[allow(dead_code)]
x: u8,
},
}

impl<'de> Deserialize<'de> for Enum {
Expand Down
1 change: 1 addition & 0 deletions tests/regression/issue845.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ where
#[derive(Deserialize, Debug)]
pub struct Struct {
#[serde(deserialize_with = "deserialize_integer_or_string")]
#[allow(dead_code)]
pub i: i64,
}

Expand Down

0 comments on commit d2dbbf7

Please sign in to comment.