From 3e287911c3a0515eda9b4d31a656516588c24638 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Sat, 2 Mar 2024 20:39:03 -0500 Subject: [PATCH] Enable `clippy::unnecessary_find_map` (#8740) This PR enables the [`clippy::unnecessary_find_map`](https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_find_map) rule and fixes the outstanding violations. Release Notes: - N/A --- crates/collab_ui/src/chat_panel.rs | 8 ++------ tooling/xtask/src/main.rs | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index b2285c51425e48de81c1b49ff5729893093045d8..9ba422dd5a1c3d339fd991dbca963bf18e2bfd1a 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -839,12 +839,8 @@ impl Render for ChatPanel { let reply_message = self .active_chat() .and_then(|active_chat| { - active_chat.read(cx).messages().iter().find_map(|m| { - if m.id == ChannelMessageId::Saved(reply_to_message_id) { - Some(m) - } else { - None - } + active_chat.read(cx).messages().iter().find(|message| { + message.id == ChannelMessageId::Saved(reply_to_message_id) }) }) .cloned(); diff --git a/tooling/xtask/src/main.rs b/tooling/xtask/src/main.rs index 11f3df1e3cc40503f3d9720ea09bf470b8b4938b..e75ec5a99cebed41c48d2b9f7458f0cbceb91b27 100644 --- a/tooling/xtask/src/main.rs +++ b/tooling/xtask/src/main.rs @@ -123,7 +123,6 @@ fn run_clippy(args: ClippyArgs) -> Result<()> { "clippy::suspicious_to_owned", "clippy::type_complexity", "clippy::unit_arg", - "clippy::unnecessary_find_map", "clippy::unnecessary_operation", "clippy::unnecessary_to_owned", "clippy::unnecessary_unwrap",