Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new dead_code warning in tuple struct and tuple variant remote defs #2671

Merged
merged 3 commits into from Jan 6, 2024

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jan 6, 2024

Warnings are new in nightly-2024-01-06 due to rust-lang/rust#118297.

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>(());
    |                       ~~

    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>(());
        |                       ~~
@dtolnay dtolnay merged commit 196f311 into serde-rs:master Jan 6, 2024
15 checks passed
@dtolnay dtolnay deleted the deadremote branch January 6, 2024 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant