Skip to content

Commit 35a76a6

Browse files
Rollup merge of rust-lang#114715 - Centri3:revert-clippy-11115, r=Manishearth
Revert clippy lint [`filter_map_bool_then`] r? `@Manishearth` Issue in question is rust-lang/rust-clippy#11309. We usually wait until the next sync but this ICE is entirely unpreventable and happens often for code where type annotations are needed alongside a lifetime parameter so I think it's a good idea to revert it here. Also, this got into 1.71.1: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=620a95846a0e4810dffb39d7594d62d7
2 parents 9546d71 + c0ae75b commit 35a76a6

File tree

8 files changed

+0
-205
lines changed

8 files changed

+0
-205
lines changed

src/tools/clippy/CHANGELOG.md

-1
Original file line numberDiff line numberDiff line change
@@ -4844,7 +4844,6 @@ Released 2018-09-13
48444844
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
48454845
[`filetype_is_file`]: https://rust-lang.github.io/rust-clippy/master/index.html#filetype_is_file
48464846
[`filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map
4847-
[`filter_map_bool_then`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_bool_then
48484847
[`filter_map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
48494848
[`filter_map_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_next
48504849
[`filter_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_next

src/tools/clippy/clippy_lints/src/declared_lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
337337
crate::methods::EXPECT_USED_INFO,
338338
crate::methods::EXTEND_WITH_DRAIN_INFO,
339339
crate::methods::FILETYPE_IS_FILE_INFO,
340-
crate::methods::FILTER_MAP_BOOL_THEN_INFO,
341340
crate::methods::FILTER_MAP_IDENTITY_INFO,
342341
crate::methods::FILTER_MAP_NEXT_INFO,
343342
crate::methods::FILTER_NEXT_INFO,

src/tools/clippy/clippy_lints/src/methods/filter_map_bool_then.rs

-45
This file was deleted.

src/tools/clippy/clippy_lints/src/methods/mod.rs

-34
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ mod expect_used;
2121
mod extend_with_drain;
2222
mod filetype_is_file;
2323
mod filter_map;
24-
mod filter_map_bool_then;
2524
mod filter_map_identity;
2625
mod filter_map_next;
2726
mod filter_next;
@@ -3477,37 +3476,6 @@ declare_clippy_lint! {
34773476
"disallows `.skip(0)`"
34783477
}
34793478

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-
35113479
declare_clippy_lint! {
35123480
/// ### What it does
35133481
/// Looks for calls to `RwLock::write` where the lock is only used for reading.
@@ -3676,7 +3644,6 @@ impl_lint_pass!(Methods => [
36763644
FORMAT_COLLECT,
36773645
STRING_LIT_CHARS_ANY,
36783646
ITER_SKIP_ZERO,
3679-
FILTER_MAP_BOOL_THEN,
36803647
READONLY_WRITE_LOCK
36813648
]);
36823649

@@ -3955,7 +3922,6 @@ impl Methods {
39553922
},
39563923
("filter_map", [arg]) => {
39573924
unnecessary_filter_map::check(cx, expr, arg, name);
3958-
filter_map_bool_then::check(cx, expr, arg, call_span);
39593925
filter_map_identity::check(cx, expr, arg, span);
39603926
},
39613927
("find_map", [arg]) => {

src/tools/clippy/clippy_utils/src/paths.rs

-2
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,3 @@ pub const OPTION_EXPECT: [&str; 4] = ["core", "option", "Option", "expect"];
163163
pub const FORMATTER: [&str; 3] = ["core", "fmt", "Formatter"];
164164
pub const DEBUG_STRUCT: [&str; 4] = ["core", "fmt", "builders", "DebugStruct"];
165165
pub const ORD_CMP: [&str; 4] = ["core", "cmp", "Ord", "cmp"];
166-
#[expect(clippy::invalid_paths)] // not sure why it thinks this, it works so
167-
pub const BOOL_THEN: [&str; 4] = ["core", "bool", "<impl bool>", "then"];

src/tools/clippy/tests/ui/filter_map_bool_then.fixed

-44
This file was deleted.

src/tools/clippy/tests/ui/filter_map_bool_then.rs

-44
This file was deleted.

src/tools/clippy/tests/ui/filter_map_bool_then.stderr

-34
This file was deleted.

0 commit comments

Comments
 (0)