diff --git a/crates/collab/src/rpc/store.rs b/crates/collab/src/rpc/store.rs index 561b7c6ab4..d1eb4a3be6 100644 --- a/crates/collab/src/rpc/store.rs +++ b/crates/collab/src/rpc/store.rs @@ -1,10 +1,6 @@ use crate::db::{self, ChannelId, ProjectId, UserId}; use anyhow::{anyhow, Result}; -use collections::{ - btree_map, - hash_map::{self, Entry}, - BTreeMap, BTreeSet, HashMap, HashSet, -}; +use collections::{btree_map, hash_map::Entry, BTreeMap, BTreeSet, HashMap, HashSet}; use rpc::{proto, ConnectionId, Receipt}; use serde::Serialize; use std::{ @@ -18,11 +14,11 @@ use tracing::instrument; #[derive(Default, Serialize)] pub struct Store { - connections: HashMap, - connections_by_user_id: HashMap>, + connections: BTreeMap, + connections_by_user_id: BTreeMap>, projects: BTreeMap, #[serde(skip)] - channels: HashMap, + channels: BTreeMap, } #[derive(Serialize)] @@ -60,7 +56,7 @@ pub struct Worktree { pub root_name: String, pub visible: bool, #[serde(skip)] - pub entries: HashMap, + pub entries: BTreeMap, #[serde(skip)] pub extension_counts: HashMap, #[serde(skip)] @@ -210,7 +206,7 @@ impl Store { pub fn leave_channel(&mut self, connection_id: ConnectionId, channel_id: ChannelId) { if let Some(connection) = self.connections.get_mut(&connection_id) { connection.channels.remove(&channel_id); - if let hash_map::Entry::Occupied(mut entry) = self.channels.entry(channel_id) { + if let btree_map::Entry::Occupied(mut entry) = self.channels.entry(channel_id) { entry.get_mut().connection_ids.remove(&connection_id); if entry.get_mut().connection_ids.is_empty() { entry.remove(); @@ -596,6 +592,7 @@ impl Store { for worktree in project.worktrees.values_mut() { worktree.diagnostic_summaries.clear(); worktree.entries.clear(); + worktree.extension_counts.clear(); } } diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 43dc2d2180..a22dcfe39e 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -24,7 +24,7 @@ use std::{ }; use tracing::instrument; -#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Serialize)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize)] pub struct ConnectionId(pub u32); impl fmt::Display for ConnectionId {