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
823823
824824 # Temporary list of style lints that we've fixed so far.
825825 comparison_to_empty = "warn"
826+for_kv_map = "warn"
826827 into_iter_on_ref = "warn"
827828 iter_cloned_collect = "warn"
828829 iter_next_slice = "warn"
crates/agent_ui/src/agent_diff.rs+1−1
@@ -1643,7 +1643,7 @@ impl AgentDiff { · 1642 unmodified lines
16431643 continue;
16441644 };
16451645
1646− for (weak_editor, _) in buffer_editors {
1646+ for weak_editor in buffer_editors.keys() {
16471647 let Some(editor) = weak_editor.upgrade() else {
16481648 continue;
16491649 };
crates/channel/src/channel_buffer.rs+1−1
@@ -135,7 +135,7 @@ impl ChannelBuffer { · 134 unmodified lines
135135 }
136136 }
137137
138− for (_, old_collaborator) in &self.collaborators {
138+ for old_collaborator in self.collaborators.values() {
139139 if !new_collaborators.contains_key(&old_collaborator.peer_id) {
140140 self.buffer.update(cx, |buffer, cx| {
141141 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
10731073
10741074 if let Some(this) = this.upgrade() {
10751075 this.update(cx, |this, cx| {
1076− for (_, buffer) in &this.opened_buffers {
1076+ for buffer in this.opened_buffers.values() {
10771077 if let OpenEntityHandle::Open(buffer) = &buffer
10781078 && let Some(buffer) = buffer.upgrade()
10791079 {
crates/extension_host/src/extension_host.rs+5−5
@@ -1175,16 +1175,16 @@ impl ExtensionStore { · 1174 unmodified lines
11751175 }
11761176 }
11771177
1178− for (server_id, _) in &extension.manifest.context_servers {
1178+ for server_id in extension.manifest.context_servers.keys() {
11791179 self.proxy.unregister_context_server(server_id.clone(), cx);
11801180 }
1181− for (adapter, _) in &extension.manifest.debug_adapters {
1181+ for adapter in extension.manifest.debug_adapters.keys() {
11821182 self.proxy.unregister_debug_adapter(adapter.clone());
11831183 }
1184− for (locator, _) in &extension.manifest.debug_locators {
1184+ for locator in extension.manifest.debug_locators.keys() {
11851185 self.proxy.unregister_debug_locator(locator.clone());
11861186 }
1187− for (command_name, _) in &extension.manifest.slash_commands {
1187+ for command_name in extension.manifest.slash_commands.keys() {
11881188 self.proxy.unregister_slash_command(command_name.clone());
11891189 }
11901190 }
@@ -1386,7 +1386,7 @@ impl ExtensionStore { · 195 unmodified lines
13861386 );
13871387 }
13881388
1389− for (id, _context_server_entry) in &manifest.context_servers {
1389+ for id in manifest.context_servers.keys() {
13901390 this.proxy
13911391 .register_context_server(extension.clone(), id.clone(), cx);
13921392 }
crates/gpui/src/platform/linux/wayland/client.rs+1−1
@@ -528,7 +528,7 @@ impl WaylandClient { · 527 unmodified lines
528528
529529 client.common.appearance = appearance;
530530
531− for (_, window) in &mut client.windows {
531+ for window in client.windows.values_mut() {
532532 window.set_appearance(appearance);
533533 }
534534 }
crates/gpui/src/platform/linux/x11/client.rs+1−1
@@ -456,7 +456,7 @@ impl X11Client { · 455 unmodified lines
456456 move |event, _, client| match event {
457457 XDPEvent::WindowAppearance(appearance) => {
458458 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() {
460460 window.window.set_appearance(appearance);
461461 }
462462 }
crates/outline_panel/src/outline_panel.rs+1−1
@@ -5338,7 +5338,7 @@ fn subscribe_for_editor_events( · 5337 unmodified lines
53385338 }
53395339 EditorEvent::Reparsed(buffer_id) => {
53405340 if let Some(excerpts) = outline_panel.excerpts.get_mut(buffer_id) {
5341− for (_, excerpt) in excerpts {
5341+ for excerpt in excerpts.values_mut() {
53425342 excerpt.invalidate_outlines();
53435343 }
53445344 }
crates/project/src/lsp_store.rs+1−1
@@ -10883,7 +10883,7 @@ impl LspStore { · 10882 unmodified lines
1088310883 // Find all worktrees that have this server in their language server tree
1088410884 for (worktree_id, servers) in &local.lsp_tree.instances {
1088510885 if *worktree_id != key.worktree_id {
10886− for (_, server_map) in &servers.roots {
10886+ for server_map in servers.roots.values() {
1088710887 if server_map.contains_key(&key.name) {
1088810888 worktrees_using_server.push(*worktree_id);
1088910889 }
crates/project/src/manifest_tree.rs+1−1
@@ -77,7 +77,7 @@ impl ManifestTree { · 76 unmodified lines
7777 _subscriptions: [
7878 cx.subscribe(&worktree_store, Self::on_worktree_store_event),
7979 cx.observe_global::<SettingsStore>(|this, cx| {
80− for (_, roots) in &mut this.root_points {
80+ for roots in this.root_points.values_mut() {
8181 roots.update(cx, |worktree_roots, _| {
8282 worktree_roots.roots = RootPathTrie::new();
8383 })
crates/project/src/manifest_tree/server_tree.rs+2−2
@@ -312,8 +312,8 @@ impl LanguageServerTree { · 311 unmodified lines
312312
313313 /// Remove nodes with a given ID from the tree.
314314 pub(crate) fn remove_nodes(&mut self, ids: &BTreeSet<LanguageServerId>) {
315− for (_, servers) in &mut self.instances {
316− for (_, nodes) in &mut servers.roots {
315+ for servers in self.instances.values_mut() {
316+ for nodes in &mut servers.roots.values_mut() {
317317 nodes.retain(|_, (node, _)| node.id.get().is_none_or(|id| !ids.contains(id)));
318318 }
319319 }