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

@ -269,32 +269,31 @@ impl Render for ApplicationMenu {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let all_menus_shown = self.all_menus_shown(cx);
if let Some(pending_menu_open) = self.pending_menu_open.take() {
if let Some(entry) = self
if let Some(pending_menu_open) = self.pending_menu_open.take()
&& let Some(entry) = self
.entries
.iter()
.find(|entry| entry.menu.name == pending_menu_open && !entry.handle.is_deployed())
{
let handle_to_show = entry.handle.clone();
let handles_to_hide: Vec<_> = self
.entries
.iter()
.filter(|e| e.menu.name != pending_menu_open && e.handle.is_deployed())
.map(|e| e.handle.clone())
.collect();
{
let handle_to_show = entry.handle.clone();
let handles_to_hide: Vec<_> = self
.entries
.iter()
.filter(|e| e.menu.name != pending_menu_open && e.handle.is_deployed())
.map(|e| e.handle.clone())
.collect();
if handles_to_hide.is_empty() {
// We need to wait for the next frame to show all menus first,
// before we can handle show/hide operations
window.on_next_frame(move |window, cx| {
handles_to_hide.iter().for_each(|handle| handle.hide(cx));
window.defer(cx, move |window, cx| handle_to_show.show(window, cx));
});
} else {
// Since menus are already shown, we can directly handle show/hide operations
if handles_to_hide.is_empty() {
// We need to wait for the next frame to show all menus first,
// before we can handle show/hide operations
window.on_next_frame(move |window, cx| {
handles_to_hide.iter().for_each(|handle| handle.hide(cx));
cx.defer_in(window, move |_, window, cx| handle_to_show.show(window, cx));
}
window.defer(cx, move |window, cx| handle_to_show.show(window, cx));
});
} else {
// Since menus are already shown, we can directly handle show/hide operations
handles_to_hide.iter().for_each(|handle| handle.hide(cx));
cx.defer_in(window, move |_, window, cx| handle_to_show.show(window, cx));
}
}

View file

@ -593,11 +593,11 @@ impl TitleBar {
Button::new("connection-status", label)
.label_size(LabelSize::Small)
.on_click(|_, window, cx| {
if let Some(auto_updater) = auto_update::AutoUpdater::get(cx) {
if auto_updater.read(cx).status().is_updated() {
workspace::reload(cx);
return;
}
if let Some(auto_updater) = auto_update::AutoUpdater::get(cx)
&& auto_updater.read(cx).status().is_updated()
{
workspace::reload(cx);
return;
}
auto_update::check(&Default::default(), window, cx);
})