Remove never-used client parameter from message handler functions (#13406)

Every single client-side RPC message handler function took an unused
`Arc<Client>` parameter. This removes that.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-06-22 16:07:36 -07:00 committed by GitHub
parent 988ee93a81
commit 6fba1e46a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 29 additions and 87 deletions

View File

@ -114,7 +114,6 @@ impl ActiveCall {
async fn handle_incoming_call( async fn handle_incoming_call(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::IncomingCall>, envelope: TypedEnvelope<proto::IncomingCall>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::Ack> { ) -> Result<proto::Ack> {
let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?; let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?;
@ -142,7 +141,6 @@ impl ActiveCall {
async fn handle_call_canceled( async fn handle_call_canceled(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::CallCanceled>, envelope: TypedEnvelope<proto::CallCanceled>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, _| { this.update(&mut cx, |this, _| {

View File

@ -697,7 +697,6 @@ impl Room {
async fn handle_room_updated( async fn handle_room_updated(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::RoomUpdated>, envelope: TypedEnvelope<proto::RoomUpdated>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let room = envelope let room = envelope

View File

@ -138,7 +138,6 @@ impl ChannelBuffer {
async fn handle_update_channel_buffer( async fn handle_update_channel_buffer(
this: Model<Self>, this: Model<Self>,
update_channel_buffer: TypedEnvelope<proto::UpdateChannelBuffer>, update_channel_buffer: TypedEnvelope<proto::UpdateChannelBuffer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let ops = update_channel_buffer let ops = update_channel_buffer
@ -160,7 +159,6 @@ impl ChannelBuffer {
async fn handle_update_channel_buffer_collaborators( async fn handle_update_channel_buffer_collaborators(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::UpdateChannelBufferCollaborators>, message: TypedEnvelope<proto::UpdateChannelBufferCollaborators>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -528,7 +528,6 @@ impl ChannelChat {
async fn handle_message_sent( async fn handle_message_sent(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::ChannelMessageSent>, message: TypedEnvelope<proto::ChannelMessageSent>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?; let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?;
@ -553,7 +552,6 @@ impl ChannelChat {
async fn handle_message_removed( async fn handle_message_removed(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::RemoveChannelMessage>, message: TypedEnvelope<proto::RemoveChannelMessage>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -565,7 +563,6 @@ impl ChannelChat {
async fn handle_message_updated( async fn handle_message_updated(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::ChannelMessageUpdate>, message: TypedEnvelope<proto::ChannelMessageUpdate>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?; let user_store = this.update(&mut cx, |this, _| this.user_store.clone())?;

View File

@ -888,7 +888,6 @@ impl ChannelStore {
async fn handle_update_channels( async fn handle_update_channels(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::UpdateChannels>, message: TypedEnvelope<proto::UpdateChannels>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, _| { this.update(&mut cx, |this, _| {
@ -902,7 +901,6 @@ impl ChannelStore {
async fn handle_update_user_channels( async fn handle_update_user_channels(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::UpdateUserChannels>, message: TypedEnvelope<proto::UpdateUserChannels>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -689,6 +689,22 @@ impl Client {
entity: WeakModel<E>, entity: WeakModel<E>,
handler: H, handler: H,
) -> Subscription ) -> Subscription
where
M: EnvelopedMessage,
E: 'static,
H: 'static + Sync + Fn(Model<E>, TypedEnvelope<M>, AsyncAppContext) -> F + Send + Sync,
F: 'static + Future<Output = Result<()>>,
{
self.add_message_handler_impl(entity, move |model, message, _, cx| {
handler(model, message, cx)
})
}
fn add_message_handler_impl<M, E, H, F>(
self: &Arc<Self>,
entity: WeakModel<E>,
handler: H,
) -> Subscription
where where
M: EnvelopedMessage, M: EnvelopedMessage,
E: 'static, E: 'static,
@ -737,19 +753,11 @@ impl Client {
where where
M: RequestMessage, M: RequestMessage,
E: 'static, E: 'static,
H: 'static H: 'static + Sync + Fn(Model<E>, TypedEnvelope<M>, AsyncAppContext) -> F + Send + Sync,
+ Sync
+ Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F
+ Send
+ Sync,
F: 'static + Future<Output = Result<M::Response>>, F: 'static + Future<Output = Result<M::Response>>,
{ {
self.add_message_handler(model, move |handle, envelope, this, cx| { self.add_message_handler_impl(model, move |handle, envelope, this, cx| {
Self::respond_to_request( Self::respond_to_request(envelope.receipt(), handler(handle, envelope, cx), this)
envelope.receipt(),
handler(handle, envelope, this.clone(), cx),
this,
)
}) })
} }
@ -757,11 +765,11 @@ impl Client {
where where
M: EntityMessage, M: EntityMessage,
E: 'static, E: 'static,
H: 'static + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send + Sync, H: 'static + Fn(Model<E>, TypedEnvelope<M>, AsyncAppContext) -> F + Send + Sync,
F: 'static + Future<Output = Result<()>>, F: 'static + Future<Output = Result<()>>,
{ {
self.add_entity_message_handler::<M, E, _, _>(move |subscriber, message, client, cx| { self.add_entity_message_handler::<M, E, _, _>(move |subscriber, message, _, cx| {
handler(subscriber.downcast::<E>().unwrap(), message, client, cx) handler(subscriber.downcast::<E>().unwrap(), message, cx)
}) })
} }
@ -808,13 +816,13 @@ impl Client {
where where
M: EntityMessage + RequestMessage, M: EntityMessage + RequestMessage,
E: 'static, E: 'static,
H: 'static + Fn(Model<E>, TypedEnvelope<M>, Arc<Self>, AsyncAppContext) -> F + Send + Sync, H: 'static + Fn(Model<E>, TypedEnvelope<M>, AsyncAppContext) -> F + Send + Sync,
F: 'static + Future<Output = Result<M::Response>>, F: 'static + Future<Output = Result<M::Response>>,
{ {
self.add_model_message_handler(move |entity, envelope, client, cx| { self.add_entity_message_handler::<M, E, _, _>(move |entity, envelope, client, cx| {
Self::respond_to_request::<M, _>( Self::respond_to_request::<M, _>(
envelope.receipt(), envelope.receipt(),
handler(entity, envelope, client.clone(), cx), handler(entity.downcast::<E>().unwrap(), envelope, cx),
client, client,
) )
}) })
@ -1912,7 +1920,7 @@ mod tests {
let (done_tx1, mut done_rx1) = smol::channel::unbounded(); let (done_tx1, mut done_rx1) = smol::channel::unbounded();
let (done_tx2, mut done_rx2) = smol::channel::unbounded(); let (done_tx2, mut done_rx2) = smol::channel::unbounded();
client.add_model_message_handler( client.add_model_message_handler(
move |model: Model<TestModel>, _: TypedEnvelope<proto::JoinProject>, _, mut cx| { move |model: Model<TestModel>, _: TypedEnvelope<proto::JoinProject>, mut cx| {
match model.update(&mut cx, |model, _| model.id).unwrap() { match model.update(&mut cx, |model, _| model.id).unwrap() {
1 => done_tx1.try_send(()).unwrap(), 1 => done_tx1.try_send(()).unwrap(),
2 => done_tx2.try_send(()).unwrap(), 2 => done_tx2.try_send(()).unwrap(),
@ -1974,7 +1982,7 @@ mod tests {
let (done_tx2, mut done_rx2) = smol::channel::unbounded(); let (done_tx2, mut done_rx2) = smol::channel::unbounded();
let subscription1 = client.add_message_handler( let subscription1 = client.add_message_handler(
model.downgrade(), model.downgrade(),
move |_, _: TypedEnvelope<proto::Ping>, _, _| { move |_, _: TypedEnvelope<proto::Ping>, _| {
done_tx1.try_send(()).unwrap(); done_tx1.try_send(()).unwrap();
async { Ok(()) } async { Ok(()) }
}, },
@ -1982,7 +1990,7 @@ mod tests {
drop(subscription1); drop(subscription1);
let _subscription2 = client.add_message_handler( let _subscription2 = client.add_message_handler(
model.downgrade(), model.downgrade(),
move |_, _: TypedEnvelope<proto::Ping>, _, _| { move |_, _: TypedEnvelope<proto::Ping>, _| {
done_tx2.try_send(()).unwrap(); done_tx2.try_send(()).unwrap();
async { Ok(()) } async { Ok(()) }
}, },
@ -2008,7 +2016,7 @@ mod tests {
let (done_tx, mut done_rx) = smol::channel::unbounded(); let (done_tx, mut done_rx) = smol::channel::unbounded();
let subscription = client.add_message_handler( let subscription = client.add_message_handler(
model.clone().downgrade(), model.clone().downgrade(),
move |model: Model<TestModel>, _: TypedEnvelope<proto::Ping>, _, mut cx| { move |model: Model<TestModel>, _: TypedEnvelope<proto::Ping>, mut cx| {
model model
.update(&mut cx, |model, _| model.subscription.take()) .update(&mut cx, |model, _| model.subscription.take())
.unwrap(); .unwrap();

View File

@ -242,7 +242,6 @@ impl UserStore {
async fn handle_update_invite_info( async fn handle_update_invite_info(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::UpdateInviteInfo>, message: TypedEnvelope<proto::UpdateInviteInfo>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -258,7 +257,6 @@ impl UserStore {
async fn handle_show_contacts( async fn handle_show_contacts(
this: Model<Self>, this: Model<Self>,
_: TypedEnvelope<proto::ShowContacts>, _: TypedEnvelope<proto::ShowContacts>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |_, cx| cx.emit(Event::ShowContacts))?; this.update(&mut cx, |_, cx| cx.emit(Event::ShowContacts))?;
@ -272,7 +270,6 @@ impl UserStore {
async fn handle_update_contacts( async fn handle_update_contacts(
this: Model<Self>, this: Model<Self>,
message: TypedEnvelope<proto::UpdateContacts>, message: TypedEnvelope<proto::UpdateContacts>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, _| { this.update(&mut cx, |this, _| {

View File

@ -124,7 +124,6 @@ impl Store {
async fn handle_dev_server_projects_update( async fn handle_dev_server_projects_update(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::DevServerProjectsUpdate>, envelope: TypedEnvelope<proto::DevServerProjectsUpdate>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -119,7 +119,6 @@ impl DevServer {
async fn handle_dev_server_instructions( async fn handle_dev_server_instructions(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::DevServerInstructions>, envelope: TypedEnvelope<proto::DevServerInstructions>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let (added_projects, removed_projects_ids) = this.read_with(&mut cx, |this, _| { let (added_projects, removed_projects_ids) = this.read_with(&mut cx, |this, _| {
@ -162,7 +161,6 @@ impl DevServer {
async fn handle_validate_dev_server_project_request( async fn handle_validate_dev_server_project_request(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ValidateDevServerProjectRequest>, envelope: TypedEnvelope<proto::ValidateDevServerProjectRequest>,
_: Arc<Client>,
cx: AsyncAppContext, cx: AsyncAppContext,
) -> Result<proto::Ack> { ) -> Result<proto::Ack> {
let expanded = shellexpand::tilde(&envelope.payload.path).to_string(); let expanded = shellexpand::tilde(&envelope.payload.path).to_string();
@ -180,7 +178,6 @@ impl DevServer {
async fn handle_shutdown( async fn handle_shutdown(
this: Model<Self>, this: Model<Self>,
_envelope: TypedEnvelope<proto::ShutdownDevServer>, _envelope: TypedEnvelope<proto::ShutdownDevServer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -209,7 +209,6 @@ impl NotificationStore {
async fn handle_new_notification( async fn handle_new_notification(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::AddNotification>, envelope: TypedEnvelope<proto::AddNotification>,
_: Arc<Client>,
cx: AsyncAppContext, cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
Self::add_notifications( Self::add_notifications(
@ -228,7 +227,6 @@ impl NotificationStore {
async fn handle_delete_notification( async fn handle_delete_notification(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::DeleteNotification>, envelope: TypedEnvelope<proto::DeleteNotification>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -240,7 +238,6 @@ impl NotificationStore {
async fn handle_update_notification( async fn handle_update_notification(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateNotification>, envelope: TypedEnvelope<proto::UpdateNotification>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {

View File

@ -4028,7 +4028,6 @@ impl Project {
async fn handle_restart_language_servers( async fn handle_restart_language_servers(
project: Model<Self>, project: Model<Self>,
envelope: TypedEnvelope<proto::RestartLanguageServers>, envelope: TypedEnvelope<proto::RestartLanguageServers>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::Ack> { ) -> Result<proto::Ack> {
project.update(&mut cx, |project, cx| { project.update(&mut cx, |project, cx| {
@ -8561,7 +8560,6 @@ impl Project {
async fn handle_blame_buffer( async fn handle_blame_buffer(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::BlameBuffer>, envelope: TypedEnvelope<proto::BlameBuffer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::BlameBufferResponse> { ) -> Result<proto::BlameBufferResponse> {
let buffer_id = BufferId::new(envelope.payload.buffer_id)?; let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
@ -8592,7 +8590,6 @@ impl Project {
async fn handle_multi_lsp_query( async fn handle_multi_lsp_query(
project: Model<Self>, project: Model<Self>,
envelope: TypedEnvelope<proto::MultiLspQuery>, envelope: TypedEnvelope<proto::MultiLspQuery>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::MultiLspQueryResponse> { ) -> Result<proto::MultiLspQueryResponse> {
let sender_id = envelope.original_sender_id()?; let sender_id = envelope.original_sender_id()?;
@ -8704,7 +8701,6 @@ impl Project {
async fn handle_unshare_project( async fn handle_unshare_project(
this: Model<Self>, this: Model<Self>,
_: TypedEnvelope<proto::UnshareProject>, _: TypedEnvelope<proto::UnshareProject>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8720,7 +8716,6 @@ impl Project {
async fn handle_add_collaborator( async fn handle_add_collaborator(
this: Model<Self>, this: Model<Self>,
mut envelope: TypedEnvelope<proto::AddProjectCollaborator>, mut envelope: TypedEnvelope<proto::AddProjectCollaborator>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let collaborator = envelope let collaborator = envelope
@ -8744,7 +8739,6 @@ impl Project {
async fn handle_update_project_collaborator( async fn handle_update_project_collaborator(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateProjectCollaborator>, envelope: TypedEnvelope<proto::UpdateProjectCollaborator>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let old_peer_id = envelope let old_peer_id = envelope
@ -8793,7 +8787,6 @@ impl Project {
async fn handle_remove_collaborator( async fn handle_remove_collaborator(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::RemoveProjectCollaborator>, envelope: TypedEnvelope<proto::RemoveProjectCollaborator>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8822,7 +8815,6 @@ impl Project {
async fn handle_update_project( async fn handle_update_project(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateProject>, envelope: TypedEnvelope<proto::UpdateProject>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8837,7 +8829,6 @@ impl Project {
async fn handle_update_worktree( async fn handle_update_worktree(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateWorktree>, envelope: TypedEnvelope<proto::UpdateWorktree>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8855,7 +8846,6 @@ impl Project {
async fn handle_update_worktree_settings( async fn handle_update_worktree_settings(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateWorktreeSettings>, envelope: TypedEnvelope<proto::UpdateWorktreeSettings>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8879,7 +8869,6 @@ impl Project {
async fn handle_create_project_entry( async fn handle_create_project_entry(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::CreateProjectEntry>, envelope: TypedEnvelope<proto::CreateProjectEntry>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ProjectEntryResponse> { ) -> Result<proto::ProjectEntryResponse> {
let worktree = this.update(&mut cx, |this, cx| { let worktree = this.update(&mut cx, |this, cx| {
@ -8893,7 +8882,6 @@ impl Project {
async fn handle_rename_project_entry( async fn handle_rename_project_entry(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::RenameProjectEntry>, envelope: TypedEnvelope<proto::RenameProjectEntry>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ProjectEntryResponse> { ) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id); let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
@ -8907,7 +8895,6 @@ impl Project {
async fn handle_copy_project_entry( async fn handle_copy_project_entry(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::CopyProjectEntry>, envelope: TypedEnvelope<proto::CopyProjectEntry>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ProjectEntryResponse> { ) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id); let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
@ -8921,7 +8908,6 @@ impl Project {
async fn handle_delete_project_entry( async fn handle_delete_project_entry(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::DeleteProjectEntry>, envelope: TypedEnvelope<proto::DeleteProjectEntry>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ProjectEntryResponse> { ) -> Result<proto::ProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id); let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
@ -8936,7 +8922,6 @@ impl Project {
async fn handle_expand_project_entry( async fn handle_expand_project_entry(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ExpandProjectEntry>, envelope: TypedEnvelope<proto::ExpandProjectEntry>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ExpandProjectEntryResponse> { ) -> Result<proto::ExpandProjectEntryResponse> {
let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id); let entry_id = ProjectEntryId::from_proto(envelope.payload.entry_id);
@ -8949,7 +8934,6 @@ impl Project {
async fn handle_update_diagnostic_summary( async fn handle_update_diagnostic_summary(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateDiagnosticSummary>, envelope: TypedEnvelope<proto::UpdateDiagnosticSummary>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -8997,7 +8981,6 @@ impl Project {
async fn handle_start_language_server( async fn handle_start_language_server(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::StartLanguageServer>, envelope: TypedEnvelope<proto::StartLanguageServer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let server = envelope let server = envelope
@ -9022,7 +9005,6 @@ impl Project {
async fn handle_update_language_server( async fn handle_update_language_server(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateLanguageServer>, envelope: TypedEnvelope<proto::UpdateLanguageServer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -9085,7 +9067,6 @@ impl Project {
async fn handle_update_buffer( async fn handle_update_buffer(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateBuffer>, envelope: TypedEnvelope<proto::UpdateBuffer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::Ack> { ) -> Result<proto::Ack> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -9123,7 +9104,6 @@ impl Project {
async fn handle_create_buffer_for_peer( async fn handle_create_buffer_for_peer(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::CreateBufferForPeer>, envelope: TypedEnvelope<proto::CreateBufferForPeer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -9209,7 +9189,6 @@ impl Project {
async fn handle_update_diff_base( async fn handle_update_diff_base(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateDiffBase>, envelope: TypedEnvelope<proto::UpdateDiffBase>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -9232,7 +9211,6 @@ impl Project {
async fn handle_update_buffer_file( async fn handle_update_buffer_file(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateBufferFile>, envelope: TypedEnvelope<proto::UpdateBufferFile>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let buffer_id = envelope.payload.buffer_id; let buffer_id = envelope.payload.buffer_id;
@ -9263,7 +9241,6 @@ impl Project {
async fn handle_save_buffer( async fn handle_save_buffer(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::SaveBuffer>, envelope: TypedEnvelope<proto::SaveBuffer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::BufferSaved> { ) -> Result<proto::BufferSaved> {
let buffer_id = BufferId::new(envelope.payload.buffer_id)?; let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
@ -9305,7 +9282,6 @@ impl Project {
async fn handle_reload_buffers( async fn handle_reload_buffers(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ReloadBuffers>, envelope: TypedEnvelope<proto::ReloadBuffers>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ReloadBuffersResponse> { ) -> Result<proto::ReloadBuffersResponse> {
let sender_id = envelope.original_sender_id()?; let sender_id = envelope.original_sender_id()?;
@ -9335,7 +9311,6 @@ impl Project {
async fn handle_synchronize_buffers( async fn handle_synchronize_buffers(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::SynchronizeBuffers>, envelope: TypedEnvelope<proto::SynchronizeBuffers>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::SynchronizeBuffersResponse> { ) -> Result<proto::SynchronizeBuffersResponse> {
let project_id = envelope.payload.project_id; let project_id = envelope.payload.project_id;
@ -9426,7 +9401,6 @@ impl Project {
async fn handle_format_buffers( async fn handle_format_buffers(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::FormatBuffers>, envelope: TypedEnvelope<proto::FormatBuffers>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::FormatBuffersResponse> { ) -> Result<proto::FormatBuffersResponse> {
let sender_id = envelope.original_sender_id()?; let sender_id = envelope.original_sender_id()?;
@ -9457,7 +9431,6 @@ impl Project {
async fn handle_apply_additional_edits_for_completion( async fn handle_apply_additional_edits_for_completion(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ApplyCompletionAdditionalEdits>, envelope: TypedEnvelope<proto::ApplyCompletionAdditionalEdits>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ApplyCompletionAdditionalEditsResponse> { ) -> Result<proto::ApplyCompletionAdditionalEditsResponse> {
let (buffer, completion) = this.update(&mut cx, |this, _| { let (buffer, completion) = this.update(&mut cx, |this, _| {
@ -9509,7 +9482,6 @@ impl Project {
async fn handle_resolve_completion_documentation( async fn handle_resolve_completion_documentation(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ResolveCompletionDocumentation>, envelope: TypedEnvelope<proto::ResolveCompletionDocumentation>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ResolveCompletionDocumentationResponse> { ) -> Result<proto::ResolveCompletionDocumentationResponse> {
let lsp_completion = serde_json::from_slice(&envelope.payload.lsp_completion)?; let lsp_completion = serde_json::from_slice(&envelope.payload.lsp_completion)?;
@ -9577,7 +9549,6 @@ impl Project {
async fn handle_apply_code_action( async fn handle_apply_code_action(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ApplyCodeAction>, envelope: TypedEnvelope<proto::ApplyCodeAction>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ApplyCodeActionResponse> { ) -> Result<proto::ApplyCodeActionResponse> {
let sender_id = envelope.original_sender_id()?; let sender_id = envelope.original_sender_id()?;
@ -9609,7 +9580,6 @@ impl Project {
async fn handle_on_type_formatting( async fn handle_on_type_formatting(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OnTypeFormatting>, envelope: TypedEnvelope<proto::OnTypeFormatting>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::OnTypeFormattingResponse> { ) -> Result<proto::OnTypeFormattingResponse> {
let on_type_formatting = this.update(&mut cx, |this, cx| { let on_type_formatting = this.update(&mut cx, |this, cx| {
@ -9642,7 +9612,6 @@ impl Project {
async fn handle_inlay_hints( async fn handle_inlay_hints(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::InlayHints>, envelope: TypedEnvelope<proto::InlayHints>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::InlayHintsResponse> { ) -> Result<proto::InlayHintsResponse> {
let sender_id = envelope.original_sender_id()?; let sender_id = envelope.original_sender_id()?;
@ -9691,7 +9660,6 @@ impl Project {
async fn handle_resolve_inlay_hint( async fn handle_resolve_inlay_hint(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::ResolveInlayHint>, envelope: TypedEnvelope<proto::ResolveInlayHint>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::ResolveInlayHintResponse> { ) -> Result<proto::ResolveInlayHintResponse> {
let proto_hint = envelope let proto_hint = envelope
@ -9726,7 +9694,6 @@ impl Project {
async fn handle_task_context_for_location( async fn handle_task_context_for_location(
project: Model<Self>, project: Model<Self>,
envelope: TypedEnvelope<proto::TaskContextForLocation>, envelope: TypedEnvelope<proto::TaskContextForLocation>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::TaskContext> { ) -> Result<proto::TaskContext> {
let location = envelope let location = envelope
@ -9769,7 +9736,6 @@ impl Project {
async fn handle_task_templates( async fn handle_task_templates(
project: Model<Self>, project: Model<Self>,
envelope: TypedEnvelope<proto::TaskTemplates>, envelope: TypedEnvelope<proto::TaskTemplates>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::TaskTemplatesResponse> { ) -> Result<proto::TaskTemplatesResponse> {
let worktree = envelope.payload.worktree_id.map(WorktreeId::from_proto); let worktree = envelope.payload.worktree_id.map(WorktreeId::from_proto);
@ -9935,7 +9901,6 @@ impl Project {
async fn handle_refresh_inlay_hints( async fn handle_refresh_inlay_hints(
this: Model<Self>, this: Model<Self>,
_: TypedEnvelope<proto::RefreshInlayHints>, _: TypedEnvelope<proto::RefreshInlayHints>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::Ack> { ) -> Result<proto::Ack> {
this.update(&mut cx, |_, cx| { this.update(&mut cx, |_, cx| {
@ -9947,7 +9912,6 @@ impl Project {
async fn handle_lsp_command<T: LspCommand>( async fn handle_lsp_command<T: LspCommand>(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<T::ProtoRequest>, envelope: TypedEnvelope<T::ProtoRequest>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<<T::ProtoRequest as proto::RequestMessage>::Response> ) -> Result<<T::ProtoRequest as proto::RequestMessage>::Response>
where where
@ -9993,7 +9957,6 @@ impl Project {
async fn handle_get_project_symbols( async fn handle_get_project_symbols(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::GetProjectSymbols>, envelope: TypedEnvelope<proto::GetProjectSymbols>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::GetProjectSymbolsResponse> { ) -> Result<proto::GetProjectSymbolsResponse> {
let symbols = this let symbols = this
@ -10010,7 +9973,6 @@ impl Project {
async fn handle_search_project( async fn handle_search_project(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::SearchProject>, envelope: TypedEnvelope<proto::SearchProject>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::SearchProjectResponse> { ) -> Result<proto::SearchProjectResponse> {
let peer_id = envelope.original_sender_id()?; let peer_id = envelope.original_sender_id()?;
@ -10050,7 +10012,6 @@ impl Project {
async fn handle_open_buffer_for_symbol( async fn handle_open_buffer_for_symbol(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OpenBufferForSymbol>, envelope: TypedEnvelope<proto::OpenBufferForSymbol>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::OpenBufferForSymbolResponse> { ) -> Result<proto::OpenBufferForSymbolResponse> {
let peer_id = envelope.original_sender_id()?; let peer_id = envelope.original_sender_id()?;
@ -10116,7 +10077,6 @@ impl Project {
async fn handle_open_buffer_by_id( async fn handle_open_buffer_by_id(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OpenBufferById>, envelope: TypedEnvelope<proto::OpenBufferById>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::OpenBufferResponse> { ) -> Result<proto::OpenBufferResponse> {
let peer_id = envelope.original_sender_id()?; let peer_id = envelope.original_sender_id()?;
@ -10130,7 +10090,6 @@ impl Project {
async fn handle_open_buffer_by_path( async fn handle_open_buffer_by_path(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OpenBufferByPath>, envelope: TypedEnvelope<proto::OpenBufferByPath>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::OpenBufferResponse> { ) -> Result<proto::OpenBufferResponse> {
let peer_id = envelope.original_sender_id()?; let peer_id = envelope.original_sender_id()?;
@ -10152,7 +10111,6 @@ impl Project {
async fn handle_open_new_buffer( async fn handle_open_new_buffer(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OpenNewBuffer>, envelope: TypedEnvelope<proto::OpenNewBuffer>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::OpenBufferResponse> { ) -> Result<proto::OpenBufferResponse> {
let buffer = this.update(&mut cx, |this, cx| this.create_local_buffer("", None, cx))?; let buffer = this.update(&mut cx, |this, cx| this.create_local_buffer("", None, cx))?;
@ -10547,7 +10505,6 @@ impl Project {
async fn handle_buffer_saved( async fn handle_buffer_saved(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::BufferSaved>, envelope: TypedEnvelope<proto::BufferSaved>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let version = deserialize_version(&envelope.payload.version); let version = deserialize_version(&envelope.payload.version);
@ -10572,7 +10529,6 @@ impl Project {
async fn handle_buffer_reloaded( async fn handle_buffer_reloaded(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::BufferReloaded>, envelope: TypedEnvelope<proto::BufferReloaded>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let payload = envelope.payload; let payload = envelope.payload;

View File

@ -4350,7 +4350,6 @@ impl WorkspaceStore {
pub async fn handle_follow( pub async fn handle_follow(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::Follow>, envelope: TypedEnvelope<proto::Follow>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<proto::FollowResponse> { ) -> Result<proto::FollowResponse> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
@ -4396,7 +4395,6 @@ impl WorkspaceStore {
async fn handle_update_followers( async fn handle_update_followers(
this: Model<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateFollowers>, envelope: TypedEnvelope<proto::UpdateFollowers>,
_: Arc<Client>,
mut cx: AsyncAppContext, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
let leader_id = envelope.original_sender_id()?; let leader_id = envelope.original_sender_id()?;