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

@ -580,19 +580,18 @@ impl Pane {
// or focus the active item itself
if let Some(weak_last_focus_handle) =
self.last_focus_handle_by_item.get(&active_item.item_id())
&& let Some(focus_handle) = weak_last_focus_handle.upgrade()
{
if let Some(focus_handle) = weak_last_focus_handle.upgrade() {
focus_handle.focus(window);
return;
}
focus_handle.focus(window);
return;
}
active_item.item_focus_handle(cx).focus(window);
} else if let Some(focused) = window.focused(cx) {
if !self.context_menu_focused(window, cx) {
self.last_focus_handle_by_item
.insert(active_item.item_id(), focused.downgrade());
}
} else if let Some(focused) = window.focused(cx)
&& !self.context_menu_focused(window, cx)
{
self.last_focus_handle_by_item
.insert(active_item.item_id(), focused.downgrade());
}
}
}
@ -858,10 +857,11 @@ impl Pane {
}
pub fn handle_item_edit(&mut self, item_id: EntityId, cx: &App) {
if let Some(preview_item) = self.preview_item() {
if preview_item.item_id() == item_id && !preview_item.preserve_preview(cx) {
self.set_preview_item_id(None, cx);
}
if let Some(preview_item) = self.preview_item()
&& preview_item.item_id() == item_id
&& !preview_item.preserve_preview(cx)
{
self.set_preview_item_id(None, cx);
}
}
@ -900,12 +900,12 @@ impl Pane {
if let Some((index, existing_item)) = existing_item {
// If the item is already open, and the item is a preview item
// and we are not allowing items to open as preview, mark the item as persistent.
if let Some(preview_item_id) = self.preview_item_id {
if let Some(tab) = self.items.get(index) {
if tab.item_id() == preview_item_id && !allow_preview {
self.set_preview_item_id(None, cx);
}
}
if let Some(preview_item_id) = self.preview_item_id
&& let Some(tab) = self.items.get(index)
&& tab.item_id() == preview_item_id
&& !allow_preview
{
self.set_preview_item_id(None, cx);
}
if activate {
self.activate_item(index, focus_item, focus_item, window, cx);
@ -977,21 +977,21 @@ impl Pane {
self.close_items_on_item_open(window, cx);
}
if item.is_singleton(cx) {
if let Some(&entry_id) = item.project_entry_ids(cx).first() {
let Some(project) = self.project.upgrade() else {
return;
};
if item.is_singleton(cx)
&& let Some(&entry_id) = item.project_entry_ids(cx).first()
{
let Some(project) = self.project.upgrade() else {
return;
};
let project = project.read(cx);
if let Some(project_path) = project.path_for_entry(entry_id, cx) {
let abs_path = project.absolute_path(&project_path, cx);
self.nav_history
.0
.lock()
.paths_by_item
.insert(item.item_id(), (project_path, abs_path));
}
let project = project.read(cx);
if let Some(project_path) = project.path_for_entry(entry_id, cx) {
let abs_path = project.absolute_path(&project_path, cx);
self.nav_history
.0
.lock()
.paths_by_item
.insert(item.item_id(), (project_path, abs_path));
}
}
// If no destination index is specified, add or move the item after the
@ -1192,12 +1192,11 @@ impl Pane {
use NavigationMode::{GoingBack, GoingForward};
if index < self.items.len() {
let prev_active_item_ix = mem::replace(&mut self.active_item_index, index);
if prev_active_item_ix != self.active_item_index
|| matches!(self.nav_history.mode(), GoingBack | GoingForward)
if (prev_active_item_ix != self.active_item_index
|| matches!(self.nav_history.mode(), GoingBack | GoingForward))
&& let Some(prev_item) = self.items.get(prev_active_item_ix)
{
if let Some(prev_item) = self.items.get(prev_active_item_ix) {
prev_item.deactivated(window, cx);
}
prev_item.deactivated(window, cx);
}
self.update_history(index);
self.update_toolbar(window, cx);
@ -2462,10 +2461,11 @@ impl Pane {
.on_mouse_down(
MouseButton::Left,
cx.listener(move |pane, event: &MouseDownEvent, _, cx| {
if let Some(id) = pane.preview_item_id {
if id == item_id && event.click_count > 1 {
pane.set_preview_item_id(None, cx);
}
if let Some(id) = pane.preview_item_id
&& id == item_id
&& event.click_count > 1
{
pane.set_preview_item_id(None, cx);
}
}),
)
@ -3048,18 +3048,18 @@ impl Pane {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(custom_drop_handle) = self.custom_drop_handle.clone() {
if let ControlFlow::Break(()) = custom_drop_handle(self, dragged_tab, window, cx) {
return;
}
if let Some(custom_drop_handle) = self.custom_drop_handle.clone()
&& let ControlFlow::Break(()) = custom_drop_handle(self, dragged_tab, window, cx)
{
return;
}
let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction;
let item_id = dragged_tab.item.item_id();
if let Some(preview_item_id) = self.preview_item_id {
if item_id == preview_item_id {
self.set_preview_item_id(None, cx);
}
if let Some(preview_item_id) = self.preview_item_id
&& item_id == preview_item_id
{
self.set_preview_item_id(None, cx);
}
let is_clone = cfg!(target_os = "macos") && window.modifiers().alt
@ -3136,11 +3136,10 @@ impl Pane {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(custom_drop_handle) = self.custom_drop_handle.clone() {
if let ControlFlow::Break(()) = custom_drop_handle(self, dragged_selection, window, cx)
{
return;
}
if let Some(custom_drop_handle) = self.custom_drop_handle.clone()
&& let ControlFlow::Break(()) = custom_drop_handle(self, dragged_selection, window, cx)
{
return;
}
self.handle_project_entry_drop(
&dragged_selection.active_selection.entry_id,
@ -3157,10 +3156,10 @@ impl Pane {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(custom_drop_handle) = self.custom_drop_handle.clone() {
if let ControlFlow::Break(()) = custom_drop_handle(self, project_entry_id, window, cx) {
return;
}
if let Some(custom_drop_handle) = self.custom_drop_handle.clone()
&& let ControlFlow::Break(()) = custom_drop_handle(self, project_entry_id, window, cx)
{
return;
}
let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction;
@ -3233,10 +3232,10 @@ impl Pane {
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(custom_drop_handle) = self.custom_drop_handle.clone() {
if let ControlFlow::Break(()) = custom_drop_handle(self, paths, window, cx) {
return;
}
if let Some(custom_drop_handle) = self.custom_drop_handle.clone()
&& let ControlFlow::Break(()) = custom_drop_handle(self, paths, window, cx)
{
return;
}
let mut to_pane = cx.entity();
let mut split_direction = self.drag_split_direction;
@ -3790,10 +3789,10 @@ impl NavHistory {
borrowed_history.paths_by_item.get(&entry.item.id())
{
f(entry, project_and_abs_path.clone());
} else if let Some(item) = entry.item.upgrade() {
if let Some(path) = item.project_path(cx) {
f(entry, (path, None));
}
} else if let Some(item) = entry.item.upgrade()
&& let Some(path) = item.project_path(cx)
{
f(entry, (path, None));
}
})
}