Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ssh-remoting: Tidy up the code a bit after #18094 (#18102)
Stanislav Alekseev8103ac12bfc5
diff --git a/crates/client/src/client.rs b/crates/client/src/client.rsindex a8387f7c5ac..48bd646d8aa 100644--- a/crates/client/src/client.rs+++ b/crates/client/src/client.rs@@ -1622,7 +1622,7 @@ impl ProtoClient for Client {&self.handler_set}- fn goes_via_collab(&self) -> bool {+ fn is_via_collab(&self) -> bool {true}}diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rsindex 7fae8b9e1db..5c3b2a00a98 100644--- a/crates/project/src/worktree_store.rs+++ b/crates/project/src/worktree_store.rs@@ -313,9 +313,10 @@ impl WorktreeStore {})}+ #[track_caller]pub fn add(&mut self, worktree: &Model<Worktree>, cx: &mut ModelContext<Self>) {let worktree_id = worktree.read(cx).id();- debug_assert!(!self.worktrees().any(|w| w.read(cx).id() == worktree_id));+ debug_assert!(self.worktrees().all(|w| w.read(cx).id() != worktree_id));let push_strong_handle = self.retain_worktrees || worktree.read(cx).is_visible();let handle = if push_strong_handle {@@ -487,7 +488,7 @@ impl WorktreeStore {};// collab has bad concurrency guarantees, so we send requests in serial.- let update_project = if downstream_client.goes_via_collab() {+ let update_project = if downstream_client.is_via_collab() {Some(downstream_client.request(update))} else {downstream_client.send(update).log_err();@@ -508,7 +509,7 @@ impl WorktreeStore {move |update| {let client = client.clone();async move {- if client.goes_via_collab() {+ if client.is_via_collab() {client.request(update).map(|result| result.is_ok()).await} else {client.send(update).is_ok()diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rsindex 10608b74f35..2bd18aa37e1 100644--- a/crates/remote/src/ssh_session.rs+++ b/crates/remote/src/ssh_session.rs@@ -471,7 +471,7 @@ impl ProtoClient for SshSession {&self.state}- fn goes_via_collab(&self) -> bool {+ fn is_via_collab(&self) -> bool {false}}diff --git a/crates/rpc/src/proto_client.rs b/crates/rpc/src/proto_client.rsindex 89ef580cdfb..88099102765 100644--- a/crates/rpc/src/proto_client.rs+++ b/crates/rpc/src/proto_client.rs@@ -28,7 +28,7 @@ pub trait ProtoClient: Send + Sync {fn message_handler_set(&self) -> &parking_lot::Mutex<ProtoMessageHandlerSet>;- fn goes_via_collab(&self) -> bool;+ fn is_via_collab(&self) -> bool;}#[derive(Default)]@@ -141,8 +141,8 @@ impl AnyProtoClient {Self(client)}- pub fn goes_via_collab(&self) -> bool {- self.0.goes_via_collab()+ pub fn is_via_collab(&self) -> bool {+ self.0.is_via_collab()}pub fn request<T: RequestMessage>(