Auto-fix clippy::collapsible_if violations (#36428)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 15:27:24 +02:00 committed by GitHub
parent 9e8ec72bd5
commit 8f567383e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
281 changed files with 6628 additions and 7089 deletions

View file

@ -121,13 +121,12 @@ impl NotificationPanel {
let notification_list = ListState::new(0, ListAlignment::Top, px(1000.));
notification_list.set_scroll_handler(cx.listener(
|this, event: &ListScrollEvent, _, cx| {
if event.count.saturating_sub(event.visible_range.end) < LOADING_THRESHOLD {
if let Some(task) = this
if event.count.saturating_sub(event.visible_range.end) < LOADING_THRESHOLD
&& let Some(task) = this
.notification_store
.update(cx, |store, cx| store.load_more_notifications(false, cx))
{
task.detach();
}
{
task.detach();
}
},
));
@ -469,20 +468,19 @@ impl NotificationPanel {
channel_id,
..
} = notification.clone()
&& let Some(workspace) = self.workspace.upgrade()
{
if let Some(workspace) = self.workspace.upgrade() {
window.defer(cx, move |window, cx| {
workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.focus_panel::<ChatPanel>(window, cx) {
panel.update(cx, |panel, cx| {
panel
.select_channel(ChannelId(channel_id), Some(message_id), cx)
.detach_and_log_err(cx);
});
}
});
window.defer(cx, move |window, cx| {
workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.focus_panel::<ChatPanel>(window, cx) {
panel.update(cx, |panel, cx| {
panel
.select_channel(ChannelId(channel_id), Some(message_id), cx)
.detach_and_log_err(cx);
});
}
});
}
});
}
}
@ -491,18 +489,18 @@ impl NotificationPanel {
return false;
}
if let Notification::ChannelMessageMention { channel_id, .. } = &notification {
if let Some(workspace) = self.workspace.upgrade() {
return if let Some(panel) = workspace.read(cx).panel::<ChatPanel>(cx) {
let panel = panel.read(cx);
panel.is_scrolled_to_bottom()
&& panel
.active_chat()
.map_or(false, |chat| chat.read(cx).channel_id.0 == *channel_id)
} else {
false
};
}
if let Notification::ChannelMessageMention { channel_id, .. } = &notification
&& let Some(workspace) = self.workspace.upgrade()
{
return if let Some(panel) = workspace.read(cx).panel::<ChatPanel>(cx) {
let panel = panel.read(cx);
panel.is_scrolled_to_bottom()
&& panel
.active_chat()
.map_or(false, |chat| chat.read(cx).channel_id.0 == *channel_id)
} else {
false
};
}
false
@ -582,16 +580,16 @@ impl NotificationPanel {
}
fn remove_toast(&mut self, notification_id: u64, cx: &mut Context<Self>) {
if let Some((current_id, _)) = &self.current_notification_toast {
if *current_id == notification_id {
self.current_notification_toast.take();
self.workspace
.update(cx, |workspace, cx| {
let id = NotificationId::unique::<NotificationToast>();
workspace.dismiss_notification(&id, cx)
})
.ok();
}
if let Some((current_id, _)) = &self.current_notification_toast
&& *current_id == notification_id
{
self.current_notification_toast.take();
self.workspace
.update(cx, |workspace, cx| {
let id = NotificationId::unique::<NotificationToast>();
workspace.dismiss_notification(&id, cx)
})
.ok();
}
}