Skip to content

Commit

Permalink
Ignore dead_code warnings in test
Browse files Browse the repository at this point in the history
    warning: trait `AssertNotSerdeSerialize` is never used
      --> test_suite/tests/test_serde_path.rs:39:7
       |
    39 | trait AssertNotSerdeSerialize {}
       |       ^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `#[warn(dead_code)]` on by default

    warning: trait `AssertNotSerdeDeserialize` is never used
      --> test_suite/tests/test_serde_path.rs:43:7
       |
    43 | trait AssertNotSerdeDeserialize<'a> {}
       |       ^^^^^^^^^^^^^^^^^^^^^^^^^

    warning: method `serialize` is never used
      --> test_suite/tests/test_serde_path.rs:31:12
       |
    30 |     pub trait Serialize {
       |               --------- method in this trait
    31 |         fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>;
       |            ^^^^^^^^^

    warning: associated function `deserialize` is never used
      --> test_suite/tests/test_serde_path.rs:35:12
       |
    34 |     pub trait Deserialize<'a>: Sized {
       |               ----------- associated function in this trait
    35 |         fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>;
       |            ^^^^^^^^^^^
  • Loading branch information
dtolnay committed Feb 8, 2024
1 parent ede9762 commit 846f865
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test_suite/tests/test_serde_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ mod fake_serde {
{
}

#[allow(dead_code)]
pub trait Serialize {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>;
}

#[allow(dead_code)]
pub trait Deserialize<'a>: Sized {
fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>;
}
}

trait AssertNotSerdeSerialize {}
pub trait AssertNotSerdeSerialize {}

impl<T: serde::Serialize> AssertNotSerdeSerialize for T {}

trait AssertNotSerdeDeserialize<'a> {}
pub trait AssertNotSerdeDeserialize<'a> {}

impl<'a, T: serde::Deserialize<'a>> AssertNotSerdeDeserialize<'a> for T {}

0 comments on commit 846f865

Please sign in to comment.