Skip to content

Commit 7c65a9d

Browse files
committed
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 { |
1 parent 8bc71de commit 7c65a9d

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

serde_derive/src/bound.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ pub fn with_bound(
144144

145145
fn visit_type(&mut self, ty: &'ast syn::Type) {
146146
match ty {
147+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
147148
syn::Type::Array(ty) => self.visit_type(&ty.elem),
148149
syn::Type::BareFn(ty) => {
149150
for arg in &ty.inputs {
@@ -181,7 +182,6 @@ pub fn with_bound(
181182

182183
syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {}
183184

184-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
185185
_ => {}
186186
}
187187
}
@@ -196,16 +196,13 @@ pub fn with_bound(
196196
syn::PathArguments::AngleBracketed(arguments) => {
197197
for arg in &arguments.args {
198198
match arg {
199+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
199200
syn::GenericArgument::Type(arg) => self.visit_type(arg),
200201
syn::GenericArgument::AssocType(arg) => self.visit_type(&arg.ty),
201202
syn::GenericArgument::Lifetime(_)
202203
| syn::GenericArgument::Const(_)
203204
| syn::GenericArgument::AssocConst(_)
204205
| syn::GenericArgument::Constraint(_) => {}
205-
#[cfg_attr(
206-
all(test, exhaustive),
207-
deny(non_exhaustive_omitted_patterns)
208-
)]
209206
_ => {}
210207
}
211208
}
@@ -228,9 +225,9 @@ pub fn with_bound(
228225

229226
fn visit_type_param_bound(&mut self, bound: &'ast syn::TypeParamBound) {
230227
match bound {
228+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
231229
syn::TypeParamBound::Trait(bound) => self.visit_path(&bound.path),
232230
syn::TypeParamBound::Lifetime(_) | syn::TypeParamBound::Verbatim(_) => {}
233-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
234231
_ => {}
235232
}
236233
}

serde_derive/src/internals/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,7 @@ fn borrowable_lifetimes(
17941794

17951795
fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
17961796
match ty {
1797+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
17971798
syn::Type::Slice(ty) => {
17981799
collect_lifetimes(&ty.elem, out);
17991800
}
@@ -1854,7 +1855,6 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
18541855
| syn::Type::Infer(_)
18551856
| syn::Type::Verbatim(_) => {}
18561857

1857-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
18581858
_ => {}
18591859
}
18601860
}

serde_derive/src/internals/receiver.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ impl ReplaceReceiver<'_> {
107107

108108
fn visit_type_mut_impl(&mut self, ty: &mut Type) {
109109
match ty {
110+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
110111
Type::Array(ty) => {
111112
self.visit_type_mut(&mut ty.elem);
112113
self.visit_expr_mut(&mut ty.len);
@@ -147,7 +148,6 @@ impl ReplaceReceiver<'_> {
147148

148149
Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {}
149150

150-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
151151
_ => {}
152152
}
153153
}
@@ -178,13 +178,13 @@ impl ReplaceReceiver<'_> {
178178
PathArguments::AngleBracketed(arguments) => {
179179
for arg in &mut arguments.args {
180180
match arg {
181+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
181182
GenericArgument::Type(arg) => self.visit_type_mut(arg),
182183
GenericArgument::AssocType(arg) => self.visit_type_mut(&mut arg.ty),
183184
GenericArgument::Lifetime(_)
184185
| GenericArgument::Const(_)
185186
| GenericArgument::AssocConst(_)
186187
| GenericArgument::Constraint(_) => {}
187-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
188188
_ => {}
189189
}
190190
}
@@ -207,9 +207,9 @@ impl ReplaceReceiver<'_> {
207207

208208
fn visit_type_param_bound_mut(&mut self, bound: &mut TypeParamBound) {
209209
match bound {
210+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
210211
TypeParamBound::Trait(bound) => self.visit_path_mut(&mut bound.path),
211212
TypeParamBound::Lifetime(_) | TypeParamBound::Verbatim(_) => {}
212-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
213213
_ => {}
214214
}
215215
}
@@ -228,14 +228,14 @@ impl ReplaceReceiver<'_> {
228228
if let Some(where_clause) = &mut generics.where_clause {
229229
for predicate in &mut where_clause.predicates {
230230
match predicate {
231+
#![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
231232
WherePredicate::Type(predicate) => {
232233
self.visit_type_mut(&mut predicate.bounded_ty);
233234
for bound in &mut predicate.bounds {
234235
self.visit_type_param_bound_mut(bound);
235236
}
236237
}
237238
WherePredicate::Lifetime(_) => {}
238-
#[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
239239
_ => {}
240240
}
241241
}

0 commit comments

Comments
 (0)