Fix clippy::for_kv_map lint violations (#36493)

Release Notes:

- N/A
This commit is contained in:
tidely 2025-08-20 12:22:19 +03:00 committed by GitHub
parent d4d049d7b9
commit 44941b5dfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 16 additions and 15 deletions

View file

@ -823,6 +823,7 @@ style = { level = "allow", priority = -1 }
# Temporary list of style lints that we've fixed so far.
comparison_to_empty = "warn"
for_kv_map = "warn"
into_iter_on_ref = "warn"
iter_cloned_collect = "warn"
iter_next_slice = "warn"

View file

@ -1643,7 +1643,7 @@ impl AgentDiff {
continue;
};
for (weak_editor, _) in buffer_editors {
for weak_editor in buffer_editors.keys() {
let Some(editor) = weak_editor.upgrade() else {
continue;
};

View file

@ -135,7 +135,7 @@ impl ChannelBuffer {
}
}
for (_, old_collaborator) in &self.collaborators {
for old_collaborator in self.collaborators.values() {
if !new_collaborators.contains_key(&old_collaborator.peer_id) {
self.buffer.update(cx, |buffer, cx| {
buffer.remove_peer(old_collaborator.replica_id, cx)

View file

@ -1073,7 +1073,7 @@ impl ChannelStore {
if let Some(this) = this.upgrade() {
this.update(cx, |this, cx| {
for (_, buffer) in &this.opened_buffers {
for buffer in this.opened_buffers.values() {
if let OpenEntityHandle::Open(buffer) = &buffer
&& let Some(buffer) = buffer.upgrade()
{

View file

@ -1175,16 +1175,16 @@ impl ExtensionStore {
}
}
for (server_id, _) in &extension.manifest.context_servers {
for server_id in extension.manifest.context_servers.keys() {
self.proxy.unregister_context_server(server_id.clone(), cx);
}
for (adapter, _) in &extension.manifest.debug_adapters {
for adapter in extension.manifest.debug_adapters.keys() {
self.proxy.unregister_debug_adapter(adapter.clone());
}
for (locator, _) in &extension.manifest.debug_locators {
for locator in extension.manifest.debug_locators.keys() {
self.proxy.unregister_debug_locator(locator.clone());
}
for (command_name, _) in &extension.manifest.slash_commands {
for command_name in extension.manifest.slash_commands.keys() {
self.proxy.unregister_slash_command(command_name.clone());
}
}
@ -1386,7 +1386,7 @@ impl ExtensionStore {
);
}
for (id, _context_server_entry) in &manifest.context_servers {
for id in manifest.context_servers.keys() {
this.proxy
.register_context_server(extension.clone(), id.clone(), cx);
}

View file

@ -528,7 +528,7 @@ impl WaylandClient {
client.common.appearance = appearance;
for (_, window) in &mut client.windows {
for window in client.windows.values_mut() {
window.set_appearance(appearance);
}
}

View file

@ -456,7 +456,7 @@ impl X11Client {
move |event, _, client| match event {
XDPEvent::WindowAppearance(appearance) => {
client.with_common(|common| common.appearance = appearance);
for (_, window) in &mut client.0.borrow_mut().windows {
for window in client.0.borrow_mut().windows.values_mut() {
window.window.set_appearance(appearance);
}
}

View file

@ -5338,7 +5338,7 @@ fn subscribe_for_editor_events(
}
EditorEvent::Reparsed(buffer_id) => {
if let Some(excerpts) = outline_panel.excerpts.get_mut(buffer_id) {
for (_, excerpt) in excerpts {
for excerpt in excerpts.values_mut() {
excerpt.invalidate_outlines();
}
}

View file

@ -10883,7 +10883,7 @@ impl LspStore {
// Find all worktrees that have this server in their language server tree
for (worktree_id, servers) in &local.lsp_tree.instances {
if *worktree_id != key.worktree_id {
for (_, server_map) in &servers.roots {
for server_map in servers.roots.values() {
if server_map.contains_key(&key.name) {
worktrees_using_server.push(*worktree_id);
}

View file

@ -77,7 +77,7 @@ impl ManifestTree {
_subscriptions: [
cx.subscribe(&worktree_store, Self::on_worktree_store_event),
cx.observe_global::<SettingsStore>(|this, cx| {
for (_, roots) in &mut this.root_points {
for roots in this.root_points.values_mut() {
roots.update(cx, |worktree_roots, _| {
worktree_roots.roots = RootPathTrie::new();
})

View file

@ -312,8 +312,8 @@ impl LanguageServerTree {
/// Remove nodes with a given ID from the tree.
pub(crate) fn remove_nodes(&mut self, ids: &BTreeSet<LanguageServerId>) {
for (_, servers) in &mut self.instances {
for (_, nodes) in &mut servers.roots {
for servers in self.instances.values_mut() {
for nodes in &mut servers.roots.values_mut() {
nodes.retain(|_, (node, _)| node.id.get().is_none_or(|id| !ids.contains(id)));
}
}