Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
remove extraneous depth field
Mikayla77cdbdb12ae3
diff --git a/crates/channel/src/channel_store.rs b/crates/channel/src/channel_store.rsindex 2aeff3afef8..b7681c6ec7d 100644--- a/crates/channel/src/channel_store.rs+++ b/crates/channel/src/channel_store.rs@@ -146,13 +146,12 @@ impl ChannelStore {})}- pub fn channel_at_index(&self, ix: usize) -> Option<(usize, &Arc<Channel>, &Arc<[ChannelId]>)> {+ pub fn channel_at_index(&self, ix: usize) -> Option<(&Arc<Channel>, &Arc<[ChannelId]>)> {let path = self.channel_index.get(ix)?;let id = path.last().unwrap();let channel = self.channel_for_id(*id).unwrap();-- Some((path.len() - 1, channel, path))+ Some((channel, path))}pub fn channel_invitations(&self) -> &[Arc<Channel>] {diff --git a/crates/channel/src/channel_store/channel_index.rs b/crates/channel/src/channel_store/channel_index.rsindex b52d7ba334e..e64c5cff5cf 100644--- a/crates/channel/src/channel_store/channel_index.rs+++ b/crates/channel/src/channel_store/channel_index.rs@@ -1,4 +1,4 @@-use std::{ops::Deref, sync::Arc};+use std::sync::Arc;use collections::HashMap;use rpc::proto;@@ -25,6 +25,18 @@ impl ChannelIndex {self.channels_by_id.clear();}+ pub fn len(&self) -> usize {+ self.paths.len()+ }++ pub fn get(&self, idx: usize) -> Option<&ChannelPath> {+ self.paths.get(idx)+ }++ pub fn iter(&self) -> impl Iterator<Item = &ChannelPath> {+ self.paths.iter()+ }+/// Remove the given edge from this index. This will not remove the channel/// and may result in dangling channels.pub fn delete_edge(&mut self, parent_id: ChannelId, channel_id: ChannelId) {@@ -50,14 +62,6 @@ impl ChannelIndex {}}-impl Deref for ChannelIndex {- type Target = Vec<ChannelPath>;-- fn deref(&self) -> &Self::Target {- &self.paths- }-}-/// A guard for ensuring that the paths index maintains its sort and uniqueness/// invariants after a series of insertionspub struct ChannelPathsUpsertGuard<'a> {diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex c9d5d97305b..9c21633c86d 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -785,8 +785,9 @@ impl CollabPanel {}let mut collapse_depth = None;for mat in matches {- let (depth, channel, path) =+ let (channel, path) =channel_store.channel_at_index(mat.candidate_id).unwrap();+ let depth = path.len() - 1;let location: ChannelLocation<'_> = (channel.id, path).into();