@@ -21,7 +21,6 @@ mod expect_used;
21
21
mod extend_with_drain;
22
22
mod filetype_is_file;
23
23
mod filter_map;
24
- mod filter_map_bool_then;
25
24
mod filter_map_identity;
26
25
mod filter_map_next;
27
26
mod filter_next;
@@ -3477,37 +3476,6 @@ declare_clippy_lint! {
3477
3476
"disallows `.skip(0)`"
3478
3477
}
3479
3478
3480
- declare_clippy_lint ! {
3481
- /// ### What it does
3482
- /// Checks for usage of `bool::then` in `Iterator::filter_map`.
3483
- ///
3484
- /// ### Why is this bad?
3485
- /// This can be written with `filter` then `map` instead, which would reduce nesting and
3486
- /// separates the filtering from the transformation phase. This comes with no cost to
3487
- /// performance and is just cleaner.
3488
- ///
3489
- /// ### Limitations
3490
- /// Does not lint `bool::then_some`, as it eagerly evaluates its arguments rather than lazily.
3491
- /// This can create differing behavior, so better safe than sorry.
3492
- ///
3493
- /// ### Example
3494
- /// ```rust
3495
- /// # fn really_expensive_fn(i: i32) -> i32 { i }
3496
- /// # let v = vec![];
3497
- /// _ = v.into_iter().filter_map(|i| (i % 2 == 0).then(|| really_expensive_fn(i)));
3498
- /// ```
3499
- /// Use instead:
3500
- /// ```rust
3501
- /// # fn really_expensive_fn(i: i32) -> i32 { i }
3502
- /// # let v = vec![];
3503
- /// _ = v.into_iter().filter(|i| i % 2 == 0).map(|i| really_expensive_fn(i));
3504
- /// ```
3505
- #[ clippy:: version = "1.72.0" ]
3506
- pub FILTER_MAP_BOOL_THEN ,
3507
- style,
3508
- "checks for usage of `bool::then` in `Iterator::filter_map`"
3509
- }
3510
-
3511
3479
declare_clippy_lint ! {
3512
3480
/// ### What it does
3513
3481
/// Looks for calls to `RwLock::write` where the lock is only used for reading.
@@ -3676,7 +3644,6 @@ impl_lint_pass!(Methods => [
3676
3644
FORMAT_COLLECT ,
3677
3645
STRING_LIT_CHARS_ANY ,
3678
3646
ITER_SKIP_ZERO ,
3679
- FILTER_MAP_BOOL_THEN ,
3680
3647
READONLY_WRITE_LOCK
3681
3648
] ) ;
3682
3649
@@ -3955,7 +3922,6 @@ impl Methods {
3955
3922
} ,
3956
3923
( "filter_map" , [ arg] ) => {
3957
3924
unnecessary_filter_map:: check ( cx, expr, arg, name) ;
3958
- filter_map_bool_then:: check ( cx, expr, arg, call_span) ;
3959
3925
filter_map_identity:: check ( cx, expr, arg, span) ;
3960
3926
} ,
3961
3927
( "find_map" , [ arg] ) => {
0 commit comments