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

@ -371,9 +371,9 @@ pub fn main() {
{
cx.spawn({
let app_state = app_state.clone();
async move |mut cx| {
if let Err(e) = restore_or_create_workspace(app_state, &mut cx).await {
fail_to_open_window_async(e, &mut cx)
async move |cx| {
if let Err(e) = restore_or_create_workspace(app_state, cx).await {
fail_to_open_window_async(e, cx)
}
}
})
@ -690,7 +690,7 @@ pub fn main() {
cx.spawn({
let client = app_state.client.clone();
async move |cx| authenticate(client, &cx).await
async move |cx| authenticate(client, cx).await
})
.detach_and_log_err(cx);
@ -722,9 +722,9 @@ pub fn main() {
None => {
cx.spawn({
let app_state = app_state.clone();
async move |mut cx| {
if let Err(e) = restore_or_create_workspace(app_state, &mut cx).await {
fail_to_open_window_async(e, &mut cx)
async move |cx| {
if let Err(e) = restore_or_create_workspace(app_state, cx).await {
fail_to_open_window_async(e, cx)
}
}
})
@ -795,14 +795,14 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
}
if let Some(connection_options) = request.ssh_connection {
cx.spawn(async move |mut cx| {
cx.spawn(async move |cx| {
let paths: Vec<PathBuf> = request.open_paths.into_iter().map(PathBuf::from).collect();
open_ssh_project(
connection_options,
paths,
app_state,
workspace::OpenOptions::default(),
&mut cx,
cx,
)
.await
})
@ -813,7 +813,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
let mut task = None;
if !request.open_paths.is_empty() || !request.diff_paths.is_empty() {
let app_state = app_state.clone();
task = Some(cx.spawn(async move |mut cx| {
task = Some(cx.spawn(async move |cx| {
let paths_with_position =
derive_paths_with_position(app_state.fs.as_ref(), request.open_paths).await;
let (_window, results) = open_paths_with_positions(
@ -821,7 +821,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
&request.diff_paths,
app_state,
workspace::OpenOptions::default(),
&mut cx,
cx,
)
.await?;
for result in results.into_iter().flatten() {
@ -834,7 +834,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
}
if !request.open_channel_notes.is_empty() || request.join_channel.is_some() {
cx.spawn(async move |mut cx| {
cx.spawn(async move |cx| {
let result = maybe!(async {
if let Some(task) = task {
task.await?;
@ -842,7 +842,7 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
let client = app_state.client.clone();
// we continue even if authentication fails as join_channel/ open channel notes will
// show a visible error message.
authenticate(client, &cx).await.log_err();
authenticate(client, cx).await.log_err();
if let Some(channel_id) = request.join_channel {
cx.update(|cx| {
@ -878,14 +878,14 @@ fn handle_open_request(request: OpenRequest, app_state: Arc<AppState>, cx: &mut
})
.await;
if let Err(err) = result {
fail_to_open_window_async(err, &mut cx);
fail_to_open_window_async(err, cx);
}
})
.detach()
} else if let Some(task) = task {
cx.spawn(async move |mut cx| {
cx.spawn(async move |cx| {
if let Err(err) = task.await {
fail_to_open_window_async(err, &mut cx);
fail_to_open_window_async(err, cx);
}
})
.detach();

View file

@ -536,7 +536,7 @@ async fn upload_previous_panics(
});
if let Some(panic) = panic
&& upload_panic(&http, &panic_report_url, panic, &mut most_recent_panic).await?
&& upload_panic(&http, panic_report_url, panic, &mut most_recent_panic).await?
{
// We've done what we can, delete the file
fs::remove_file(child_path)
@ -566,7 +566,7 @@ pub async fn upload_previous_minidumps(http: Arc<HttpClientWithUrl>) -> anyhow::
if let Ok(metadata) = serde_json::from_slice(&smol::fs::read(&json_path).await?) {
if upload_minidump(
http.clone(),
&minidump_endpoint,
minidump_endpoint,
smol::fs::read(&child_path)
.await
.context("Failed to read minidump")?,

View file

@ -327,7 +327,7 @@ pub fn initialize_workspace(
cx.subscribe_in(&workspace_handle, window, {
move |workspace, _, event, window, cx| match event {
workspace::Event::PaneAdded(pane) => {
initialize_pane(workspace, &pane, window, cx);
initialize_pane(workspace, pane, window, cx);
}
workspace::Event::OpenBundledFile {
text,
@ -796,7 +796,7 @@ fn register_actions(
.register_action(install_cli)
.register_action(|_, _: &install_cli::RegisterZedScheme, window, cx| {
cx.spawn_in(window, async move |workspace, cx| {
install_cli::register_zed_scheme(&cx).await?;
install_cli::register_zed_scheme(cx).await?;
workspace.update_in(cx, |workspace, _, cx| {
struct RegisterZedScheme;

View file

@ -650,7 +650,7 @@ impl ComponentPreview {
_window: &mut Window,
_cx: &mut Context<Self>,
) -> impl IntoElement {
let component = self.component_map.get(&component_id);
let component = self.component_map.get(component_id);
if let Some(component) = component {
v_flex()

View file

@ -147,7 +147,7 @@ fn assign_edit_prediction_providers(
assign_edit_prediction_provider(
editor,
provider,
&client,
client,
user_store.clone(),
window,
cx,
@ -248,7 +248,7 @@ fn assign_edit_prediction_provider(
if let Some(buffer) = &singleton_buffer {
if buffer.read(cx).file().is_some() {
zeta.update(cx, |zeta, cx| {
zeta.register_buffer(&buffer, cx);
zeta.register_buffer(buffer, cx);
});
}
}

View file

@ -432,13 +432,13 @@ async fn open_workspaces(
.connection_options_for(ssh.host, ssh.port, ssh.user)
});
if let Ok(connection_options) = connection_options {
cx.spawn(async move |mut cx| {
cx.spawn(async move |cx| {
open_ssh_project(
connection_options,
ssh.paths.into_iter().map(PathBuf::from).collect(),
app_state,
OpenOptions::default(),
&mut cx,
cx,
)
.await
.log_err();

View file

@ -182,7 +182,7 @@ impl Render for QuickActionBar {
let code_action_element = if is_deployed {
editor.update(cx, |editor, cx| {
if let Some(style) = editor.style() {
editor.render_context_menu(&style, MAX_CODE_ACTION_MENU_LINES, window, cx)
editor.render_context_menu(style, MAX_CODE_ACTION_MENU_LINES, window, cx)
} else {
None
}