From 45271c36760c59a86a59d2a80eae58efd87ae577 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 11 Aug 2023 20:27:16 -0700 Subject: [PATCH] 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 --- serde_derive/src/internals/attr.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs index 895ea7ee0..d5512348b 100644 --- a/serde_derive/src/internals/attr.rs +++ b/serde_derive/src/internals/attr.rs @@ -707,7 +707,7 @@ fn decide_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"; cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(tag_tokens, msg); @@ -718,14 +718,14 @@ fn decide_tag( cx.error_spanned_by(content_tokens, msg); TagType::External } - (Some((untagged_tokens, _)), None, Some((content_tokens, _))) => { + (Some((untagged_tokens, ())), None, Some((content_tokens, _))) => { let msg = "untagged enum cannot have #[serde(content = \"...\")]"; cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(content_tokens, msg); TagType::External } (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 = \"...\")]"; cx.error_spanned_by(untagged_tokens, msg); cx.error_spanned_by(tag_tokens, msg); @@ -747,7 +747,7 @@ fn decide_identifier( variant_identifier.0.get_with_tokens(), ) { (_, None, None) => Identifier::No, - (_, Some((field_identifier_tokens, _)), Some((variant_identifier_tokens, _))) => { + (_, Some((field_identifier_tokens, ())), Some((variant_identifier_tokens, ()))) => { let msg = "#[serde(field_identifier)] and #[serde(variant_identifier)] cannot both be set"; cx.error_spanned_by(field_identifier_tokens, msg);