Enable clippy::option_map_unit_fn (#8751)

This PR enables the
[`clippy::option_map_unit_fn`](https://rust-lang.github.io/rust-clippy/master/index.html#/option_map_unit_fn)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-02 22:08:37 -05:00 committed by GitHub
parent d19957b705
commit ea68f86476
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 75 additions and 55 deletions

View file

@ -1433,16 +1433,20 @@ impl Pane {
"Close Clean",
Some(Box::new(CloseCleanItems)),
cx.handler_for(&pane, move |pane, cx| {
pane.close_clean_items(&CloseCleanItems, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_clean_items(&CloseCleanItems, cx) {
task.detach_and_log_err(cx)
}
}),
)
.entry(
"Close All",
Some(Box::new(CloseAllItems { save_intent: None })),
cx.handler_for(&pane, |pane, cx| {
pane.close_all_items(&CloseAllItems { save_intent: None }, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) =
pane.close_all_items(&CloseAllItems { save_intent: None }, cx)
{
task.detach_and_log_err(cx)
}
}),
);
@ -1783,42 +1787,49 @@ impl Render for Pane {
}))
.on_action(
cx.listener(|pane: &mut Self, action: &CloseActiveItem, cx| {
pane.close_active_item(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_active_item(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(
cx.listener(|pane: &mut Self, action: &CloseInactiveItems, cx| {
pane.close_inactive_items(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_inactive_items(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(
cx.listener(|pane: &mut Self, action: &CloseCleanItems, cx| {
pane.close_clean_items(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_clean_items(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(
cx.listener(|pane: &mut Self, action: &CloseItemsToTheLeft, cx| {
pane.close_items_to_the_left(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_items_to_the_left(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(
cx.listener(|pane: &mut Self, action: &CloseItemsToTheRight, cx| {
pane.close_items_to_the_right(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_items_to_the_right(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(cx.listener(|pane: &mut Self, action: &CloseAllItems, cx| {
pane.close_all_items(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_all_items(action, cx) {
task.detach_and_log_err(cx)
}
}))
.on_action(
cx.listener(|pane: &mut Self, action: &CloseActiveItem, cx| {
pane.close_active_item(action, cx)
.map(|task| task.detach_and_log_err(cx));
if let Some(task) = pane.close_active_item(action, cx) {
task.detach_and_log_err(cx)
}
}),
)
.on_action(