Fix clippy::needless_borrow lint violations (#36444)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-18 23:54:35 +02:00 committed by GitHub
parent eecf142f06
commit 9e0e233319
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 801 additions and 821 deletions

View file

@ -1038,7 +1038,7 @@ where
{
fn detach_and_notify_err(self, window: &mut Window, cx: &mut App) {
window
.spawn(cx, async move |mut cx| self.await.notify_async_err(&mut cx))
.spawn(cx, async move |cx| self.await.notify_async_err(cx))
.detach();
}
}

View file

@ -1627,8 +1627,7 @@ impl Pane {
items_to_close
.iter()
.filter(|item| {
item.is_dirty(cx)
&& !Self::skip_save_on_close(item.as_ref(), &workspace, cx)
item.is_dirty(cx) && !Self::skip_save_on_close(item.as_ref(), workspace, cx)
})
.map(|item| item.boxed_clone())
.collect::<Vec<_>>()
@ -1657,7 +1656,7 @@ impl Pane {
let mut should_save = true;
if save_intent == SaveIntent::Close {
workspace.update(cx, |workspace, cx| {
if Self::skip_save_on_close(item_to_close.as_ref(), &workspace, cx) {
if Self::skip_save_on_close(item_to_close.as_ref(), workspace, cx) {
should_save = false;
}
})?;

View file

@ -647,7 +647,7 @@ impl ProjectItemRegistry {
.build_project_item_for_path_fns
.iter()
.rev()
.find_map(|open_project_item| open_project_item(&project, &path, window, cx))
.find_map(|open_project_item| open_project_item(project, path, window, cx))
else {
return Task::ready(Err(anyhow!("cannot open file {:?}", path.path)));
};
@ -2431,7 +2431,7 @@ impl Workspace {
);
window.prompt(
PromptLevel::Warning,
&"Do you want to save all changes in the following files?",
"Do you want to save all changes in the following files?",
Some(&detail),
&["Save all", "Discard all", "Cancel"],
cx,
@ -2767,9 +2767,9 @@ impl Workspace {
let item = pane.read(cx).active_item();
let pane = pane.downgrade();
window.spawn(cx, async move |mut cx| {
window.spawn(cx, async move |cx| {
if let Some(item) = item {
Pane::save_item(project, &pane, item.as_ref(), save_intent, &mut cx)
Pane::save_item(project, &pane, item.as_ref(), save_intent, cx)
.await
.map(|_| ())
} else {
@ -3889,14 +3889,14 @@ impl Workspace {
pane.track_alternate_file_items();
});
if *local {
self.unfollow_in_pane(&pane, window, cx);
self.unfollow_in_pane(pane, window, cx);
}
serialize_workspace = *focus_changed || pane != self.active_pane();
if pane == self.active_pane() {
self.active_item_path_changed(window, cx);
self.update_active_view_for_followers(window, cx);
} else if *local {
self.set_active_pane(&pane, window, cx);
self.set_active_pane(pane, window, cx);
}
}
pane::Event::UserSavedItem { item, save_intent } => {
@ -7182,9 +7182,9 @@ pub fn open_paths(
.collect::<Vec<_>>();
cx.update(|cx| {
for window in local_workspace_windows(&cx) {
if let Ok(workspace) = window.read(&cx) {
let m = workspace.project.read(&cx).visibility_for_paths(
for window in local_workspace_windows(cx) {
if let Ok(workspace) = window.read(cx) {
let m = workspace.project.read(cx).visibility_for_paths(
&abs_paths,
&all_metadatas,
open_options.open_new_workspace == None,
@ -7341,7 +7341,7 @@ pub fn open_ssh_project_with_new_connection(
) -> Task<Result<()>> {
cx.spawn(async move |cx| {
let (serialized_ssh_project, workspace_id, serialized_workspace) =
serialize_ssh_project(connection_options.clone(), paths.clone(), &cx).await?;
serialize_ssh_project(connection_options.clone(), paths.clone(), cx).await?;
let session = match cx
.update(|cx| {
@ -7395,7 +7395,7 @@ pub fn open_ssh_project_with_existing_connection(
) -> Task<Result<()>> {
cx.spawn(async move |cx| {
let (serialized_ssh_project, workspace_id, serialized_workspace) =
serialize_ssh_project(connection_options.clone(), paths.clone(), &cx).await?;
serialize_ssh_project(connection_options.clone(), paths.clone(), cx).await?;
open_ssh_project_inner(
project,