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

@ -442,14 +442,14 @@ impl LocalLspStore {
match result {
Ok(server) => {
lsp_store
.update(cx, |lsp_store, mut cx| {
.update(cx, |lsp_store, cx| {
lsp_store.insert_newly_running_language_server(
adapter,
server.clone(),
server_id,
key,
pending_workspace_folders,
&mut cx,
cx,
);
})
.ok();
@ -1927,7 +1927,7 @@ impl LocalLspStore {
if let Some(lsp_edits) = lsp_edits {
this.update(cx, |this, cx| {
this.as_local_mut().unwrap().edits_from_lsp(
&buffer_handle,
buffer_handle,
lsp_edits,
language_server.server_id(),
None,
@ -3115,7 +3115,7 @@ impl LocalLspStore {
let mut servers_to_remove = BTreeSet::default();
let mut servers_to_preserve = HashSet::default();
for (seed, ref state) in &self.language_server_ids {
for (seed, state) in &self.language_server_ids {
if seed.worktree_id == id_to_remove {
servers_to_remove.insert(state.id);
} else {
@ -3169,7 +3169,7 @@ impl LocalLspStore {
for watcher in watchers {
if let Some((worktree, literal_prefix, pattern)) =
self.worktree_and_path_for_file_watcher(&worktrees, &watcher, cx)
self.worktree_and_path_for_file_watcher(&worktrees, watcher, cx)
{
worktree.update(cx, |worktree, _| {
if let Some((tree, glob)) =
@ -4131,7 +4131,7 @@ impl LspStore {
local.registered_buffers.remove(&buffer_id);
local.buffers_opened_in_servers.remove(&buffer_id);
if let Some(file) = File::from_dyn(buffer.read(cx).file()).cloned() {
local.unregister_old_buffer_from_language_servers(&buffer, &file, cx);
local.unregister_old_buffer_from_language_servers(buffer, &file, cx);
}
}
})
@ -4453,7 +4453,7 @@ impl LspStore {
.contains(&server_status.name)
.then_some(server_id)
})
.filter_map(|server_id| self.lsp_server_capabilities.get(&server_id))
.filter_map(|server_id| self.lsp_server_capabilities.get(server_id))
.any(check)
}
@ -5419,7 +5419,7 @@ impl LspStore {
) -> Task<Result<Vec<LocationLink>>> {
if let Some((upstream_client, project_id)) = self.upstream_client() {
let request = GetTypeDefinitions { position };
if !self.is_capable_for_proto_request(&buffer, &request, cx) {
if !self.is_capable_for_proto_request(buffer, &request, cx) {
return Task::ready(Ok(Vec::new()));
}
let request_task = upstream_client.request(proto::MultiLspQuery {
@ -5573,7 +5573,7 @@ impl LspStore {
) -> Task<Result<Vec<Location>>> {
if let Some((upstream_client, project_id)) = self.upstream_client() {
let request = GetReferences { position };
if !self.is_capable_for_proto_request(&buffer, &request, cx) {
if !self.is_capable_for_proto_request(buffer, &request, cx) {
return Task::ready(Ok(Vec::new()));
}
let request_task = upstream_client.request(proto::MultiLspQuery {
@ -5755,7 +5755,7 @@ impl LspStore {
let lsp_data = self.lsp_code_lens.entry(buffer_id).or_default();
if let Some((updating_for, running_update)) = &lsp_data.update {
if !version_queried_for.changed_since(&updating_for) {
if !version_queried_for.changed_since(updating_for) {
return running_update.clone();
}
}
@ -6786,7 +6786,7 @@ impl LspStore {
let lsp_data = self.lsp_document_colors.entry(buffer_id).or_default();
if let Some((updating_for, running_update)) = &lsp_data.colors_update {
if !version_queried_for.changed_since(&updating_for) {
if !version_queried_for.changed_since(updating_for) {
return Some(running_update.clone());
}
}
@ -10057,7 +10057,7 @@ impl LspStore {
) -> Shared<Task<Option<HashMap<String, String>>>> {
if let Some(environment) = &self.as_local().map(|local| local.environment.clone()) {
environment.update(cx, |env, cx| {
env.get_buffer_environment(&buffer, &self.worktree_store, cx)
env.get_buffer_environment(buffer, &self.worktree_store, cx)
})
} else {
Task::ready(None).shared()
@ -11175,7 +11175,7 @@ impl LspStore {
let Some(local) = self.as_local() else { return };
local.prettier_store.update(cx, |prettier_store, cx| {
prettier_store.update_prettier_settings(&worktree_handle, changes, cx)
prettier_store.update_prettier_settings(worktree_handle, changes, cx)
});
let worktree_id = worktree_handle.read(cx).id();