Fix a bunch of other low-hanging style lints (#36498)
- **Fix a bunch of low hanging style lints like unnecessary-return** - **Fix single worktree violation** - **And the rest** Release Notes: - N/A
This commit is contained in:
parent
df9c2aefb1
commit
05fc0c432c
239 changed files with 854 additions and 1015 deletions
|
@ -1804,7 +1804,7 @@ impl Workspace {
|
|||
.max_by(|b1, b2| b1.worktree_id.cmp(&b2.worktree_id))
|
||||
});
|
||||
|
||||
latest_project_path_opened.map_or(true, |path| path == history_path)
|
||||
latest_project_path_opened.is_none_or(|path| path == history_path)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -2284,7 +2284,7 @@ impl Workspace {
|
|||
// the current session.
|
||||
if close_intent != CloseIntent::Quit
|
||||
&& !save_last_workspace
|
||||
&& save_result.as_ref().map_or(false, |&res| res)
|
||||
&& save_result.as_ref().is_ok_and(|&res| res)
|
||||
{
|
||||
this.update_in(cx, |this, window, cx| this.remove_from_session(window, cx))?
|
||||
.await;
|
||||
|
@ -5133,13 +5133,11 @@ impl Workspace {
|
|||
self.panes.retain(|p| p != pane);
|
||||
if let Some(focus_on) = focus_on {
|
||||
focus_on.update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
|
||||
} else {
|
||||
if self.active_pane() == pane {
|
||||
self.panes
|
||||
.last()
|
||||
.unwrap()
|
||||
.update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
|
||||
}
|
||||
} else if self.active_pane() == pane {
|
||||
self.panes
|
||||
.last()
|
||||
.unwrap()
|
||||
.update(cx, |pane, cx| window.focus(&pane.focus_handle(cx)));
|
||||
}
|
||||
if self.last_active_center_pane == Some(pane.downgrade()) {
|
||||
self.last_active_center_pane = None;
|
||||
|
@ -5893,7 +5891,6 @@ impl Workspace {
|
|||
|
||||
pub fn cancel(&mut self, _: &menu::Cancel, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if cx.stop_active_drag(window) {
|
||||
return;
|
||||
} else if let Some((notification_id, _)) = self.notifications.pop() {
|
||||
dismiss_app_notification(¬ification_id, cx);
|
||||
} else {
|
||||
|
@ -6100,7 +6097,7 @@ fn open_items(
|
|||
// here is a directory, it was already opened further above
|
||||
// with a `find_or_create_worktree`.
|
||||
if let Ok(task) = abs_path_task
|
||||
&& task.await.map_or(true, |p| p.is_file())
|
||||
&& task.await.is_none_or(|p| p.is_file())
|
||||
{
|
||||
return Some((
|
||||
ix,
|
||||
|
@ -6970,7 +6967,7 @@ async fn join_channel_internal(
|
|||
&& project.visible_worktrees(cx).any(|tree| {
|
||||
tree.read(cx)
|
||||
.root_entry()
|
||||
.map_or(false, |entry| entry.is_dir())
|
||||
.is_some_and(|entry| entry.is_dir())
|
||||
})
|
||||
{
|
||||
Some(workspace.project.clone())
|
||||
|
@ -7900,7 +7897,6 @@ fn join_pane_into_active(
|
|||
cx: &mut App,
|
||||
) {
|
||||
if pane == active_pane {
|
||||
return;
|
||||
} else if pane.read(cx).items_len() == 0 {
|
||||
pane.update(cx, |_, cx| {
|
||||
cx.emit(pane::Event::Remove {
|
||||
|
@ -9149,11 +9145,11 @@ mod tests {
|
|||
workspace.update_in(cx, |workspace, window, cx| {
|
||||
workspace.add_item_to_active_pane(Box::new(item.clone()), None, false, window, cx);
|
||||
});
|
||||
return item;
|
||||
item
|
||||
}
|
||||
|
||||
fn split_pane(cx: &mut VisualTestContext, workspace: &Entity<Workspace>) -> Entity<Pane> {
|
||||
return workspace.update_in(cx, |workspace, window, cx| {
|
||||
workspace.update_in(cx, |workspace, window, cx| {
|
||||
let new_pane = workspace.split_pane(
|
||||
workspace.active_pane().clone(),
|
||||
SplitDirection::Right,
|
||||
|
@ -9161,7 +9157,7 @@ mod tests {
|
|||
cx,
|
||||
);
|
||||
new_pane
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue