Skip to content

Commit

Permalink
Add FIXME to fix dead_code warning when using serde(remote)
Browse files Browse the repository at this point in the history
    warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:143:24
        |
    143 | struct PrimitivePubDef(u8);
        |        --------------- ^^
        |        |
        |        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
        |
    143 | struct PrimitivePubDef(());
        |                        ~~

    warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:162:20
        |
    162 | struct TuplePubDef(u8, #[serde(with = "UnitDef")] remote::Unit);
        |        ----------- ^^
        |        |
        |        field in this struct
        |
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    162 | struct TuplePubDef((), #[serde(with = "UnitDef")] remote::Unit);
        |                    ~~

    warning: field `0` is never read
       --> test_suite/tests/test_remote.rs:200:13
        |
    200 |     Variant(u8),
        |     ------- ^^
        |     |
        |     field in this variant
        |
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    200 |     Variant(()),
        |             ~~

    error: field `0` is never read
       --> test_suite/tests/test_gen.rs:390:23
        |
    390 |     struct StrDef<'a>(&'a str);
        |            ------     ^^^^^^^
        |            |
        |            field in this struct
        |
    note: the lint level is defined here
       --> test_suite/tests/test_gen.rs:5:9
        |
    5   | #![deny(warnings)]
        |         ^^^^^^^^
        = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    390 |     struct StrDef<'a>(());
        |                       ~~
  • Loading branch information
dtolnay committed Jan 6, 2024
1 parent d883c94 commit 6f1a8c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions test_suite/tests/test_gen.rs
Expand Up @@ -387,6 +387,7 @@ fn test_gen() {

#[derive(Serialize, Deserialize)]
#[serde(remote = "Str")]
#[allow(dead_code)] // FIXME
struct StrDef<'a>(&'a str);

#[derive(Serialize, Deserialize)]
Expand Down
3 changes: 3 additions & 0 deletions test_suite/tests/test_remote.rs
Expand Up @@ -140,6 +140,7 @@ struct PrimitivePrivDef(#[serde(getter = "remote::PrimitivePriv::get")] u8);

#[derive(Serialize, Deserialize)]
#[serde(remote = "remote::PrimitivePub")]
#[allow(dead_code)] // FIXME
struct PrimitivePubDef(u8);

#[derive(Serialize, Deserialize)]
Expand All @@ -159,6 +160,7 @@ struct TuplePrivDef(

#[derive(Serialize, Deserialize)]
#[serde(remote = "remote::TuplePub")]
#[allow(dead_code)] // FIXME
struct TuplePubDef(u8, #[serde(with = "UnitDef")] remote::Unit);

#[derive(Serialize, Deserialize)]
Expand Down Expand Up @@ -196,6 +198,7 @@ struct StructConcrete {

#[derive(Serialize, Deserialize)]
#[serde(remote = "remote::EnumGeneric<u8>")]
#[allow(dead_code)] // FIXME
enum EnumConcrete {
Variant(u8),
}
Expand Down

0 comments on commit 6f1a8c3

Please sign in to comment.