Resolve redundant_closure_for_method_calls clippy lints

error: redundant closure
      --> serde_derive/src/bound.rs:53:19
       |
    53 |         .flat_map(|predicates| predicates.to_vec());
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `[T]::to_vec`
       |
    note: the lint level is defined here
      --> serde_derive/src/lib.rs:18:22
       |
    18 | #![deny(clippy::all, clippy::pedantic)]
       |                      ^^^^^^^^^^^^^^^^
       = note: `#[deny(clippy::redundant_closure_for_method_calls)]` implied by `#[deny(clippy::pedantic)]`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

    error: redundant closure
      --> serde_derive/src/bound.rs:75:19
       |
    75 |         .flat_map(|predicates| predicates.to_vec());
       |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `[T]::to_vec`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
This commit is contained in:
David Tolnay 2021-09-30 00:25:00 -04:00
parent 5c785eee58
commit fc827ecec2
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -50,7 +50,7 @@ pub fn with_where_predicates_from_fields(
.data
.all_fields()
.filter_map(|field| from_field(&field.attrs))
.flat_map(|predicates| predicates.to_vec());
.flat_map(<[syn::WherePredicate]>::to_vec);
let mut generics = generics.clone();
generics.make_where_clause().predicates.extend(predicates);
@ -72,7 +72,7 @@ pub fn with_where_predicates_from_variants(
let predicates = variants
.iter()
.filter_map(|variant| from_variant(&variant.attrs))
.flat_map(|predicates| predicates.to_vec());
.flat_map(<[syn::WherePredicate]>::to_vec);
let mut generics = generics.clone();
generics.make_where_clause().predicates.extend(predicates);