History

Fix `clippy::for_kv_map` lint violations (#36493)

Release Notes: - N/A

tidely committed 1 year ago

Commit 44941b51 parent d4d049d11 files · +16 −15Browse files

Unified · Split

11 files
  1. Cargo.toml +1 −0
  2. crates/agent_ui/src/agent_diff.rs +1 −1
  3. crates/channel/src/channel_buffer.rs +1 −1
  4. crates/channel/src/channel_store.rs +1 −1
  5. crates/extension_host/src/extension_host.rs +5 −5
  6. crates/gpui/src/platform/linux/wayland/client.rs +1 −1
  7. crates/gpui/src/platform/linux/x11/client.rs +1 −1
  8. crates/outline_panel/src/outline_panel.rs +1 −1
  9. crates/project/src/lsp_store.rs +1 −1
  10. crates/project/src/manifest_tree.rs +1 −1
  11. crates/project/src/manifest_tree/server_tree.rs +2 −2
Cargo.toml+1−0
@@ -823,6 +823,7 @@ style = { level = "allow", priority = -1 } · 822 unmodified lines
823 823
824# Temporary list of style lints that we've fixed so far.824# Temporary list of style lints that we've fixed so far.
825comparison_to_empty = "warn"825comparison_to_empty = "warn"
826for_kv_map = "warn"
826into_iter_on_ref = "warn"827into_iter_on_ref = "warn"
827iter_cloned_collect = "warn"828iter_cloned_collect = "warn"
828iter_next_slice = "warn"829iter_next_slice = "warn"
crates/agent_ui/src/agent_diff.rs+1−1
@@ -1643,7 +1643,7 @@ impl AgentDiff { · 1642 unmodified lines
1643 continue;1643 continue;
1644 };1644 };
1645 1645
1646 for (weak_editor, _) in buffer_editors {1646 for weak_editor in buffer_editors.keys() {
1647 let Some(editor) = weak_editor.upgrade() else {1647 let Some(editor) = weak_editor.upgrade() else {
1648 continue;1648 continue;
1649 };1649 };
crates/channel/src/channel_buffer.rs+1−1
@@ -135,7 +135,7 @@ impl ChannelBuffer { · 134 unmodified lines
135 }135 }
136 }136 }
137 137
138 for (_, old_collaborator) in &self.collaborators {138 for old_collaborator in self.collaborators.values() {
139 if !new_collaborators.contains_key(&old_collaborator.peer_id) {139 if !new_collaborators.contains_key(&old_collaborator.peer_id) {
140 self.buffer.update(cx, |buffer, cx| {140 self.buffer.update(cx, |buffer, cx| {
141 buffer.remove_peer(old_collaborator.replica_id, cx)141 buffer.remove_peer(old_collaborator.replica_id, cx)
crates/channel/src/channel_store.rs+1−1
@@ -1073,7 +1073,7 @@ impl ChannelStore { · 1072 unmodified lines
1073 1073
1074 if let Some(this) = this.upgrade() {1074 if let Some(this) = this.upgrade() {
1075 this.update(cx, |this, cx| {1075 this.update(cx, |this, cx| {
1076 for (_, buffer) in &this.opened_buffers {1076 for buffer in this.opened_buffers.values() {
1077 if let OpenEntityHandle::Open(buffer) = &buffer1077 if let OpenEntityHandle::Open(buffer) = &buffer
1078 && let Some(buffer) = buffer.upgrade()1078 && let Some(buffer) = buffer.upgrade()
1079 {1079 {
crates/extension_host/src/extension_host.rs+5−5
@@ -1175,16 +1175,16 @@ impl ExtensionStore { · 1174 unmodified lines
1175 }1175 }
1176 }1176 }
1177 1177
1178 for (server_id, _) in &extension.manifest.context_servers {1178 for server_id in extension.manifest.context_servers.keys() {
1179 self.proxy.unregister_context_server(server_id.clone(), cx);1179 self.proxy.unregister_context_server(server_id.clone(), cx);
1180 }1180 }
1181 for (adapter, _) in &extension.manifest.debug_adapters {1181 for adapter in extension.manifest.debug_adapters.keys() {
1182 self.proxy.unregister_debug_adapter(adapter.clone());1182 self.proxy.unregister_debug_adapter(adapter.clone());
1183 }1183 }
1184 for (locator, _) in &extension.manifest.debug_locators {1184 for locator in extension.manifest.debug_locators.keys() {
1185 self.proxy.unregister_debug_locator(locator.clone());1185 self.proxy.unregister_debug_locator(locator.clone());
1186 }1186 }
1187 for (command_name, _) in &extension.manifest.slash_commands {1187 for command_name in extension.manifest.slash_commands.keys() {
1188 self.proxy.unregister_slash_command(command_name.clone());1188 self.proxy.unregister_slash_command(command_name.clone());
1189 }1189 }
1190 }1190 }
@@ -1386,7 +1386,7 @@ impl ExtensionStore { · 195 unmodified lines
1386 );1386 );
1387 }1387 }
1388 1388
1389 for (id, _context_server_entry) in &manifest.context_servers {1389 for id in manifest.context_servers.keys() {
1390 this.proxy1390 this.proxy
1391 .register_context_server(extension.clone(), id.clone(), cx);1391 .register_context_server(extension.clone(), id.clone(), cx);
1392 }1392 }
crates/gpui/src/platform/linux/wayland/client.rs+1−1
@@ -528,7 +528,7 @@ impl WaylandClient { · 527 unmodified lines
528 528
529 client.common.appearance = appearance;529 client.common.appearance = appearance;
530 530
531 for (_, window) in &mut client.windows {531 for window in client.windows.values_mut() {
532 window.set_appearance(appearance);532 window.set_appearance(appearance);
533 }533 }
534 }534 }
crates/gpui/src/platform/linux/x11/client.rs+1−1
@@ -456,7 +456,7 @@ impl X11Client { · 455 unmodified lines
456 move |event, _, client| match event {456 move |event, _, client| match event {
457 XDPEvent::WindowAppearance(appearance) => {457 XDPEvent::WindowAppearance(appearance) => {
458 client.with_common(|common| common.appearance = appearance);458 client.with_common(|common| common.appearance = appearance);
459 for (_, window) in &mut client.0.borrow_mut().windows {459 for window in client.0.borrow_mut().windows.values_mut() {
460 window.window.set_appearance(appearance);460 window.window.set_appearance(appearance);
461 }461 }
462 }462 }
crates/outline_panel/src/outline_panel.rs+1−1
@@ -5338,7 +5338,7 @@ fn subscribe_for_editor_events( · 5337 unmodified lines
5338 }5338 }
5339 EditorEvent::Reparsed(buffer_id) => {5339 EditorEvent::Reparsed(buffer_id) => {
5340 if let Some(excerpts) = outline_panel.excerpts.get_mut(buffer_id) {5340 if let Some(excerpts) = outline_panel.excerpts.get_mut(buffer_id) {
5341 for (_, excerpt) in excerpts {5341 for excerpt in excerpts.values_mut() {
5342 excerpt.invalidate_outlines();5342 excerpt.invalidate_outlines();
5343 }5343 }
5344 }5344 }
crates/project/src/lsp_store.rs+1−1
@@ -10883,7 +10883,7 @@ impl LspStore { · 10882 unmodified lines
10883 // Find all worktrees that have this server in their language server tree10883 // Find all worktrees that have this server in their language server tree
10884 for (worktree_id, servers) in &local.lsp_tree.instances {10884 for (worktree_id, servers) in &local.lsp_tree.instances {
10885 if *worktree_id != key.worktree_id {10885 if *worktree_id != key.worktree_id {
10886 for (_, server_map) in &servers.roots {10886 for server_map in servers.roots.values() {
10887 if server_map.contains_key(&key.name) {10887 if server_map.contains_key(&key.name) {
10888 worktrees_using_server.push(*worktree_id);10888 worktrees_using_server.push(*worktree_id);
10889 }10889 }
crates/project/src/manifest_tree.rs+1−1
@@ -77,7 +77,7 @@ impl ManifestTree { · 76 unmodified lines
77 _subscriptions: [77 _subscriptions: [
78 cx.subscribe(&worktree_store, Self::on_worktree_store_event),78 cx.subscribe(&worktree_store, Self::on_worktree_store_event),
79 cx.observe_global::<SettingsStore>(|this, cx| {79 cx.observe_global::<SettingsStore>(|this, cx| {
80 for (_, roots) in &mut this.root_points {80 for roots in this.root_points.values_mut() {
81 roots.update(cx, |worktree_roots, _| {81 roots.update(cx, |worktree_roots, _| {
82 worktree_roots.roots = RootPathTrie::new();82 worktree_roots.roots = RootPathTrie::new();
83 })83 })
crates/project/src/manifest_tree/server_tree.rs+2−2
@@ -312,8 +312,8 @@ impl LanguageServerTree { · 311 unmodified lines
312 312
313 /// Remove nodes with a given ID from the tree.313 /// Remove nodes with a given ID from the tree.
314 pub(crate) fn remove_nodes(&mut self, ids: &BTreeSet<LanguageServerId>) {314 pub(crate) fn remove_nodes(&mut self, ids: &BTreeSet<LanguageServerId>) {
315 for (_, servers) in &mut self.instances {315 for servers in self.instances.values_mut() {
316 for (_, nodes) in &mut servers.roots {316 for nodes in &mut servers.roots.values_mut() {
317 nodes.retain(|_, (node, _)| node.id.get().is_none_or(|id| !ids.contains(id)));317 nodes.retain(|_, (node, _)| node.id.get().is_none_or(|id| !ids.contains(id)));
318 }318 }
319 }319 }