From 7c65a9dc0eab2d4d829b258a7b3549351bbe8dcd Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 3 Jan 2024 18:35:30 -0800 Subject: [PATCH] Pick up changes to non_exhaustive_omitted_patterns lint warning: the lint level must be set on the whole match --> serde_derive/src/internals/attr.rs:1855:9 | 1854 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 1855 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 1796 + #[deny(non_exhaustive_omitted_patterns)] 1797 | match ty { | warning: the lint level must be set on the whole match --> serde_derive/src/internals/receiver.rs:151:13 | 150 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 151 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 109 + #[deny(non_exhaustive_omitted_patterns)] 110 | match ty { | warning: the lint level must be set on the whole match --> serde_derive/src/internals/receiver.rs:188:25 | 187 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 188 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 180 + #[deny(non_exhaustive_omitted_patterns)] 181 | match arg { | warning: the lint level must be set on the whole match --> serde_derive/src/internals/receiver.rs:213:13 | 212 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 213 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 209 + #[deny(non_exhaustive_omitted_patterns)] 210 | match bound { | warning: the lint level must be set on the whole match --> serde_derive/src/internals/receiver.rs:239:21 | 238 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 239 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 230 + #[deny(non_exhaustive_omitted_patterns)] 231 | match predicate { | warning: the lint level must be set on the whole match --> serde_derive/src/bound.rs:185:17 | 184 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 185 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 146 + #[deny(non_exhaustive_omitted_patterns)] 147 | match ty { | warning: the lint level must be set on the whole match --> serde_derive/src/bound.rs:209:29 | 207 | ... deny(non_exhaustive_omitted_patterns) | ------------------------------- remove this attribute 208 | ... )] 209 | ... _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 198 + #[deny(non_exhaustive_omitted_patterns)] 199 | match arg { | warning: the lint level must be set on the whole match --> serde_derive/src/bound.rs:234:17 | 233 | #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] | ------------------------------- remove this attribute 234 | _ => {} | ^ | = help: it no longer has any effect to set the lint level on an individual match arm help: set the lint level on the whole match | 230 + #[deny(non_exhaustive_omitted_patterns)] 231 | match bound { | --- serde_derive/src/bound.rs | 9 +++------ serde_derive/src/internals/attr.rs | 2 +- serde_derive/src/internals/receiver.rs | 8 ++++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/serde_derive/src/bound.rs b/serde_derive/src/bound.rs index dd51e689..fe8ccfff 100644 --- a/serde_derive/src/bound.rs +++ b/serde_derive/src/bound.rs @@ -144,6 +144,7 @@ pub fn with_bound( fn visit_type(&mut self, ty: &'ast syn::Type) { match ty { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] syn::Type::Array(ty) => self.visit_type(&ty.elem), syn::Type::BareFn(ty) => { for arg in &ty.inputs { @@ -181,7 +182,6 @@ pub fn with_bound( syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } @@ -196,16 +196,13 @@ pub fn with_bound( syn::PathArguments::AngleBracketed(arguments) => { for arg in &arguments.args { match arg { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] syn::GenericArgument::Type(arg) => self.visit_type(arg), syn::GenericArgument::AssocType(arg) => self.visit_type(&arg.ty), syn::GenericArgument::Lifetime(_) | syn::GenericArgument::Const(_) | syn::GenericArgument::AssocConst(_) | syn::GenericArgument::Constraint(_) => {} - #[cfg_attr( - all(test, exhaustive), - deny(non_exhaustive_omitted_patterns) - )] _ => {} } } @@ -228,9 +225,9 @@ pub fn with_bound( fn visit_type_param_bound(&mut self, bound: &'ast syn::TypeParamBound) { match bound { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] syn::TypeParamBound::Trait(bound) => self.visit_path(&bound.path), syn::TypeParamBound::Lifetime(_) | syn::TypeParamBound::Verbatim(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs index 58d18b40..bb9de328 100644 --- a/serde_derive/src/internals/attr.rs +++ b/serde_derive/src/internals/attr.rs @@ -1794,6 +1794,7 @@ fn borrowable_lifetimes( fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet) { match ty { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] syn::Type::Slice(ty) => { collect_lifetimes(&ty.elem, out); } @@ -1854,7 +1855,6 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet) { | syn::Type::Infer(_) | syn::Type::Verbatim(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } diff --git a/serde_derive/src/internals/receiver.rs b/serde_derive/src/internals/receiver.rs index 6273dfec..fa2a77d2 100644 --- a/serde_derive/src/internals/receiver.rs +++ b/serde_derive/src/internals/receiver.rs @@ -107,6 +107,7 @@ impl ReplaceReceiver<'_> { fn visit_type_mut_impl(&mut self, ty: &mut Type) { match ty { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] Type::Array(ty) => { self.visit_type_mut(&mut ty.elem); self.visit_expr_mut(&mut ty.len); @@ -147,7 +148,6 @@ impl ReplaceReceiver<'_> { Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } @@ -178,13 +178,13 @@ impl ReplaceReceiver<'_> { PathArguments::AngleBracketed(arguments) => { for arg in &mut arguments.args { match arg { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] GenericArgument::Type(arg) => self.visit_type_mut(arg), GenericArgument::AssocType(arg) => self.visit_type_mut(&mut arg.ty), GenericArgument::Lifetime(_) | GenericArgument::Const(_) | GenericArgument::AssocConst(_) | GenericArgument::Constraint(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } @@ -207,9 +207,9 @@ impl ReplaceReceiver<'_> { fn visit_type_param_bound_mut(&mut self, bound: &mut TypeParamBound) { match bound { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] TypeParamBound::Trait(bound) => self.visit_path_mut(&mut bound.path), TypeParamBound::Lifetime(_) | TypeParamBound::Verbatim(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } } @@ -228,6 +228,7 @@ impl ReplaceReceiver<'_> { if let Some(where_clause) = &mut generics.where_clause { for predicate in &mut where_clause.predicates { match predicate { + #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] WherePredicate::Type(predicate) => { self.visit_type_mut(&mut predicate.bounded_ty); for bound in &mut predicate.bounds { @@ -235,7 +236,6 @@ impl ReplaceReceiver<'_> { } } WherePredicate::Lifetime(_) => {} - #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] _ => {} } }