Resolve ignored_unit_patterns pedantic clippy lint

warning: matching over `()` is more explicit
       --> serde_derive/src/internals/attr.rs:710:33
        |
    710 |         (Some((untagged_tokens, _)), Some((tag_tokens, _)), None) => {
        |                                 ^ help: use `()` instead of `_`: `()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
        = note: `-W clippy::ignored-unit-patterns` implied by `-W clippy::pedantic`

    warning: matching over `()` is more explicit
       --> serde_derive/src/internals/attr.rs:721:33
        |
    721 |         (Some((untagged_tokens, _)), None, Some((content_tokens, _))) => {
        |                                 ^ help: use `()` instead of `_`: `()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns

    warning: matching over `()` is more explicit
       --> serde_derive/src/internals/attr.rs:728:33
        |
    728 |         (Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => {
        |                                 ^ help: use `()` instead of `_`: `()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns

    warning: matching over `()` is more explicit
       --> serde_derive/src/internals/attr.rs:750:44
        |
    750 |         (_, Some((field_identifier_tokens, _)), Some((variant_identifier_tokens, _))) => {
        |                                            ^ help: use `()` instead of `_`: `()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns

    warning: matching over `()` is more explicit
       --> serde_derive/src/internals/attr.rs:750:82
        |
    750 |         (_, Some((field_identifier_tokens, _)), Some((variant_identifier_tokens, _))) => {
        |                                                                                  ^ help: use `()` instead of `_`: `()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
This commit is contained in:
David Tolnay 2023-08-11 20:27:16 -07:00
parent 05a5b7e3c6
commit 45271c3676
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -707,7 +707,7 @@ fn decide_tag(
} }
TagType::Internal { tag } TagType::Internal { tag }
} }
(Some((untagged_tokens, _)), Some((tag_tokens, _)), None) => { (Some((untagged_tokens, ())), Some((tag_tokens, _)), None) => {
let msg = "enum cannot be both untagged and internally tagged"; let msg = "enum cannot be both untagged and internally tagged";
cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(untagged_tokens, msg);
cx.error_spanned_by(tag_tokens, msg); cx.error_spanned_by(tag_tokens, msg);
@ -718,14 +718,14 @@ fn decide_tag(
cx.error_spanned_by(content_tokens, msg); cx.error_spanned_by(content_tokens, msg);
TagType::External TagType::External
} }
(Some((untagged_tokens, _)), None, Some((content_tokens, _))) => { (Some((untagged_tokens, ())), None, Some((content_tokens, _))) => {
let msg = "untagged enum cannot have #[serde(content = \"...\")]"; let msg = "untagged enum cannot have #[serde(content = \"...\")]";
cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(untagged_tokens, msg);
cx.error_spanned_by(content_tokens, msg); cx.error_spanned_by(content_tokens, msg);
TagType::External TagType::External
} }
(None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { tag, content }, (None, Some((_, tag)), Some((_, content))) => TagType::Adjacent { tag, content },
(Some((untagged_tokens, _)), Some((tag_tokens, _)), Some((content_tokens, _))) => { (Some((untagged_tokens, ())), Some((tag_tokens, _)), Some((content_tokens, _))) => {
let msg = "untagged enum cannot have #[serde(tag = \"...\", content = \"...\")]"; let msg = "untagged enum cannot have #[serde(tag = \"...\", content = \"...\")]";
cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(untagged_tokens, msg);
cx.error_spanned_by(tag_tokens, msg); cx.error_spanned_by(tag_tokens, msg);
@ -747,7 +747,7 @@ fn decide_identifier(
variant_identifier.0.get_with_tokens(), variant_identifier.0.get_with_tokens(),
) { ) {
(_, None, None) => Identifier::No, (_, None, None) => Identifier::No,
(_, Some((field_identifier_tokens, _)), Some((variant_identifier_tokens, _))) => { (_, Some((field_identifier_tokens, ())), Some((variant_identifier_tokens, ()))) => {
let msg = let msg =
"#[serde(field_identifier)] and #[serde(variant_identifier)] cannot both be set"; "#[serde(field_identifier)] and #[serde(variant_identifier)] cannot both be set";
cx.error_spanned_by(field_identifier_tokens, msg); cx.error_spanned_by(field_identifier_tokens, msg);