Skip to content

Commit

Permalink
Resolve flat_map_option pedantic clippy lint
Browse files Browse the repository at this point in the history
    error: used `flat_map` where `filter_map` could be used instead
      --> serde_derive/src/bound.rs:52:10
       |
    52 |         .flat_map(|field| from_field(&field.attrs))
       |          ^^^^^^^^ help: try: `filter_map`
       |
    note: the lint level is defined here
      --> serde_derive/src/lib.rs:18:22
       |
    18 | #![deny(clippy::all, clippy::pedantic)]
       |                      ^^^^^^^^^^^^^^^^
       = note: `#[deny(clippy::flat_map_option)]` implied by `#[deny(clippy::pedantic)]`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#flat_map_option

    error: used `flat_map` where `filter_map` could be used instead
      --> serde_derive/src/bound.rs:74:10
       |
    74 |         .flat_map(|variant| from_variant(&variant.attrs))
       |          ^^^^^^^^ help: try: `filter_map`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#flat_map_option
  • Loading branch information
dtolnay committed Apr 25, 2021
1 parent 2ea132b commit 1093f7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions serde_derive/src/bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn with_where_predicates_from_fields(
let predicates = cont
.data
.all_fields()
.flat_map(|field| from_field(&field.attrs))
.filter_map(|field| from_field(&field.attrs))
.flat_map(|predicates| predicates.to_vec());

let mut generics = generics.clone();
Expand All @@ -71,7 +71,7 @@ pub fn with_where_predicates_from_variants(

let predicates = variants
.iter()
.flat_map(|variant| from_variant(&variant.attrs))
.filter_map(|variant| from_variant(&variant.attrs))
.flat_map(|predicates| predicates.to_vec());

let mut generics = generics.clone();
Expand Down

0 comments on commit 1093f7e

Please sign in to comment.