diff --git a/Cargo.toml b/Cargo.toml index ae3df6cf95..55f8980115 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -371,7 +371,6 @@ style = "allow" almost_complete_range = "allow" arc_with_non_send_sync = "allow" await_holding_lock = "allow" -borrow_deref_ref = "allow" borrowed_box = "allow" cast_abs_to_unsigned = "allow" cmp_owned = "allow" diff --git a/crates/collab/src/db/queries/buffers.rs b/crates/collab/src/db/queries/buffers.rs index 4ebca6cebb..eddde98fd9 100644 --- a/crates/collab/src/db/queries/buffers.rs +++ b/crates/collab/src/db/queries/buffers.rs @@ -308,7 +308,7 @@ impl Database { connection_lost: ActiveValue::set(true), ..Default::default() }) - .exec(&*tx) + .exec(tx) .await?; Ok(()) } @@ -363,7 +363,7 @@ impl Database { .eq(connection.owner_id as i32), ), ) - .exec(&*tx) + .exec(tx) .await?; if result.rows_affected == 0 { Err(anyhow!("not a collaborator on this project"))?; @@ -375,7 +375,7 @@ impl Database { .filter( Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)), ) - .stream(&*tx) + .stream(tx) .await?; while let Some(row) = rows.next().await { let row = row?; @@ -429,7 +429,7 @@ impl Database { Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)), ) .into_values::<_, QueryUserIds>() - .all(&*tx) + .all(tx) .await?; Ok(users) @@ -602,7 +602,7 @@ impl Database { .select_only() .column(buffer_snapshot::Column::OperationSerializationVersion) .into_values::<_, QueryOperationSerializationVersion>() - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!("missing buffer snapshot"))?) } @@ -617,7 +617,7 @@ impl Database { ..Default::default() } .find_related(buffer::Entity) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!("no such buffer"))?) } @@ -639,7 +639,7 @@ impl Database { .eq(id) .and(buffer_snapshot::Column::Epoch.eq(buffer.epoch)), ) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!("no such snapshot"))?; @@ -657,7 +657,7 @@ impl Database { ) .order_by_asc(buffer_operation::Column::LamportTimestamp) .order_by_asc(buffer_operation::Column::ReplicaId) - .stream(&*tx) + .stream(tx) .await?; let mut operations = Vec::new(); @@ -751,7 +751,7 @@ impl Database { tx: &DatabaseTransaction, ) -> Result> { let latest_operations = self - .get_latest_operations_for_buffers(channel_ids_by_buffer_id.keys().copied(), &*tx) + .get_latest_operations_for_buffers(channel_ids_by_buffer_id.keys().copied(), tx) .await?; Ok(latest_operations @@ -781,7 +781,7 @@ impl Database { observed_buffer_edits::Column::BufferId .is_in(channel_ids_by_buffer_id.keys().copied()), ) - .all(&*tx) + .all(tx) .await?; Ok(observed_operations @@ -844,7 +844,7 @@ impl Database { let stmt = Statement::from_string(self.pool.get_database_backend(), sql); Ok(buffer_operation::Entity::find() .from_raw_sql(stmt) - .all(&*tx) + .all(tx) .await?) } } diff --git a/crates/collab/src/db/queries/channels.rs b/crates/collab/src/db/queries/channels.rs index 376a44b6eb..2d622a94d8 100644 --- a/crates/collab/src/db/queries/channels.rs +++ b/crates/collab/src/db/queries/channels.rs @@ -441,9 +441,9 @@ impl Database { user_id: UserId, tx: &DatabaseTransaction, ) -> Result { - let new_channels = self.get_user_channels(user_id, Some(channel), &*tx).await?; + let new_channels = self.get_user_channels(user_id, Some(channel), tx).await?; let removed_channels = self - .get_channel_descendants_excluding_self([channel], &*tx) + .get_channel_descendants_excluding_self([channel], tx) .await? .into_iter() .map(|channel| channel.id) @@ -564,16 +564,16 @@ impl Database { let channel_memberships = channel_member::Entity::find() .filter(filter) - .all(&*tx) + .all(tx) .await?; let channels = channel::Entity::find() .filter(channel::Column::Id.is_in(channel_memberships.iter().map(|m| m.channel_id))) - .all(&*tx) + .all(tx) .await?; let mut descendants = self - .get_channel_descendants_excluding_self(channels.iter(), &*tx) + .get_channel_descendants_excluding_self(channels.iter(), tx) .await?; for channel in channels { @@ -614,7 +614,7 @@ impl Database { .column(room::Column::ChannelId) .column(room_participant::Column::UserId) .into_values::<_, QueryUserIdsAndChannelIds>() - .stream(&*tx) + .stream(tx) .await?; while let Some(row) = rows.next().await { let row: (ChannelId, UserId) = row?; @@ -627,7 +627,7 @@ impl Database { let mut channel_ids_by_buffer_id = HashMap::default(); let mut rows = buffer::Entity::find() .filter(buffer::Column::ChannelId.is_in(channel_ids.iter().copied())) - .stream(&*tx) + .stream(tx) .await?; while let Some(row) = rows.next().await { let row = row?; @@ -636,21 +636,21 @@ impl Database { drop(rows); let latest_buffer_versions = self - .latest_channel_buffer_changes(&channel_ids_by_buffer_id, &*tx) + .latest_channel_buffer_changes(&channel_ids_by_buffer_id, tx) .await?; - let latest_channel_messages = self.latest_channel_messages(&channel_ids, &*tx).await?; + let latest_channel_messages = self.latest_channel_messages(&channel_ids, tx).await?; let observed_buffer_versions = self - .observed_channel_buffer_changes(&channel_ids_by_buffer_id, user_id, &*tx) + .observed_channel_buffer_changes(&channel_ids_by_buffer_id, user_id, tx) .await?; let observed_channel_messages = self - .observed_channel_messages(&channel_ids, user_id, &*tx) + .observed_channel_messages(&channel_ids, user_id, tx) .await?; let hosted_projects = self - .get_hosted_projects(&channel_ids, &roles_by_channel_id, &*tx) + .get_hosted_projects(&channel_ids, &roles_by_channel_id, tx) .await?; Ok(ChannelsForUser { @@ -778,7 +778,7 @@ impl Database { tx: &DatabaseTransaction, ) -> Result> { let participants = self - .get_channel_participant_details_internal(channel, &*tx) + .get_channel_participant_details_internal(channel, tx) .await?; Ok(participants .into_iter() @@ -855,7 +855,7 @@ impl Database { .filter(channel_member::Column::ChannelId.eq(channel.root_id())) .filter(channel_member::Column::UserId.eq(user_id)) .filter(channel_member::Column::Accepted.eq(false)) - .one(&*tx) + .one(tx) .await?; Ok(row) @@ -875,7 +875,7 @@ impl Database { .and(channel_member::Column::UserId.eq(user_id)) .and(channel_member::Column::Accepted.eq(true)), ) - .one(&*tx) + .one(tx) .await?; let Some(membership) = membership else { @@ -930,7 +930,7 @@ impl Database { tx: &DatabaseTransaction, ) -> Result { Ok(channel::Entity::find_by_id(channel_id) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| proto::ErrorCode::NoSuchChannel.anyhow())?) } @@ -943,7 +943,7 @@ impl Database { ) -> Result { let room = room::Entity::find() .filter(room::Column::ChannelId.eq(channel_id)) - .one(&*tx) + .one(tx) .await?; let room_id = if let Some(room) = room { @@ -954,7 +954,7 @@ impl Database { live_kit_room: ActiveValue::Set(live_kit_room.to_string()), ..Default::default() }) - .exec(&*tx) + .exec(tx) .await?; result.last_insert_id diff --git a/crates/collab/src/db/queries/hosted_projects.rs b/crates/collab/src/db/queries/hosted_projects.rs index 394f1055c6..ca91e2822e 100644 --- a/crates/collab/src/db/queries/hosted_projects.rs +++ b/crates/collab/src/db/queries/hosted_projects.rs @@ -11,7 +11,7 @@ impl Database { ) -> Result> { Ok(hosted_project::Entity::find() .filter(hosted_project::Column::ChannelId.is_in(channel_ids.iter().map(|id| id.0))) - .all(&*tx) + .all(tx) .await? .into_iter() .flat_map(|project| { @@ -47,11 +47,11 @@ impl Database { tx: &DatabaseTransaction, ) -> Result<(hosted_project::Model, ChannelRole)> { let project = hosted_project::Entity::find_by_id(hosted_project_id) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!(ErrorCode::NoSuchProject))?; let channel = channel::Entity::find_by_id(project.channel_id) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!(ErrorCode::NoSuchChannel))?; diff --git a/crates/collab/src/db/queries/messages.rs b/crates/collab/src/db/queries/messages.rs index 83796d4512..663e1d0f83 100644 --- a/crates/collab/src/db/queries/messages.rs +++ b/crates/collab/src/db/queries/messages.rs @@ -171,7 +171,7 @@ impl Database { .filter(channel_message_mention::Column::MessageId.is_in(messages.iter().map(|m| m.id))) .order_by_asc(channel_message_mention::Column::MessageId) .order_by_asc(channel_message_mention::Column::StartOffset) - .stream(&*tx) + .stream(tx) .await?; let mut message_ix = 0; @@ -384,7 +384,7 @@ impl Database { .to_owned(), ) // TODO: Try to upgrade SeaORM so we don't have to do this hack around their bug - .exec_without_returning(&*tx) + .exec_without_returning(tx) .await?; Ok(()) } @@ -401,7 +401,7 @@ impl Database { observed_channel_messages::Column::ChannelId .is_in(channel_ids.iter().map(|id| id.0)), ) - .all(&*tx) + .all(tx) .await?; Ok(rows @@ -452,7 +452,7 @@ impl Database { let stmt = Statement::from_string(self.pool.get_database_backend(), sql); let mut last_messages = channel_message::Model::find_by_statement(stmt) - .stream(&*tx) + .stream(tx) .await?; let mut results = Vec::new(); diff --git a/crates/collab/src/db/queries/notifications.rs b/crates/collab/src/db/queries/notifications.rs index ccdda65342..5a44f62a53 100644 --- a/crates/collab/src/db/queries/notifications.rs +++ b/crates/collab/src/db/queries/notifications.rs @@ -95,7 +95,7 @@ impl Database { content: ActiveValue::Set(proto.content.clone()), ..Default::default() } - .save(&*tx) + .save(tx) .await?; Ok(Some(( @@ -184,7 +184,7 @@ impl Database { tx: &DatabaseTransaction, ) -> Result> { if let Some(id) = self - .find_notification(recipient_id, notification, &*tx) + .find_notification(recipient_id, notification, tx) .await? { let row = notification::Entity::update(notification::ActiveModel { @@ -236,7 +236,7 @@ impl Database { }), ) .into_values::<_, QueryIds>() - .one(&*tx) + .one(tx) .await?) } } diff --git a/crates/collab/src/db/queries/projects.rs b/crates/collab/src/db/queries/projects.rs index 190f854bfa..c051882d95 100644 --- a/crates/collab/src/db/queries/projects.rs +++ b/crates/collab/src/db/queries/projects.rs @@ -186,7 +186,7 @@ impl Database { .update_column(worktree::Column::RootName) .to_owned(), ) - .exec(&*tx) + .exec(tx) .await?; } @@ -194,7 +194,7 @@ impl Database { .filter(worktree::Column::ProjectId.eq(project_id).and( worktree::Column::Id.is_not_in(worktrees.iter().map(|worktree| worktree.id as i64)), )) - .exec(&*tx) + .exec(tx) .await?; Ok(()) @@ -584,7 +584,7 @@ impl Database { ) -> Result<(Project, ReplicaId)> { let mut collaborators = project .find_related(project_collaborator::Entity) - .all(&*tx) + .all(tx) .await?; let replica_ids = collaborators .iter() @@ -603,11 +603,11 @@ impl Database { is_host: ActiveValue::set(false), ..Default::default() } - .insert(&*tx) + .insert(tx) .await?; collaborators.push(new_collaborator); - let db_worktrees = project.find_related(worktree::Entity).all(&*tx).await?; + let db_worktrees = project.find_related(worktree::Entity).all(tx).await?; let mut worktrees = db_worktrees .into_iter() .map(|db_worktree| { @@ -637,7 +637,7 @@ impl Database { .add(worktree_entry::Column::ProjectId.eq(project.id)) .add(worktree_entry::Column::IsDeleted.eq(false)), ) - .stream(&*tx) + .stream(tx) .await?; while let Some(db_entry) = db_entries.next().await { let db_entry = db_entry?; @@ -668,7 +668,7 @@ impl Database { .add(worktree_repository::Column::ProjectId.eq(project.id)) .add(worktree_repository::Column::IsDeleted.eq(false)), ) - .stream(&*tx) + .stream(tx) .await?; while let Some(db_repository_entry) = db_repository_entries.next().await { let db_repository_entry = db_repository_entry?; @@ -689,7 +689,7 @@ impl Database { { let mut db_summaries = worktree_diagnostic_summary::Entity::find() .filter(worktree_diagnostic_summary::Column::ProjectId.eq(project.id)) - .stream(&*tx) + .stream(tx) .await?; while let Some(db_summary) = db_summaries.next().await { let db_summary = db_summary?; @@ -710,7 +710,7 @@ impl Database { { let mut db_settings_files = worktree_settings_file::Entity::find() .filter(worktree_settings_file::Column::ProjectId.eq(project.id)) - .stream(&*tx) + .stream(tx) .await?; while let Some(db_settings_file) = db_settings_files.next().await { let db_settings_file = db_settings_file?; @@ -726,7 +726,7 @@ impl Database { // Populate language servers. let language_servers = project .find_related(language_server::Entity) - .all(&*tx) + .all(tx) .await?; let project = Project { diff --git a/crates/collab/src/db/queries/rooms.rs b/crates/collab/src/db/queries/rooms.rs index 13707d6f47..dcb31266df 100644 --- a/crates/collab/src/db/queries/rooms.rs +++ b/crates/collab/src/db/queries/rooms.rs @@ -374,7 +374,7 @@ impl Database { .select_only() .column(room_participant::Column::ParticipantIndex) .into_values::<_, QueryParticipantIndices>() - .all(&*tx) + .all(tx) .await?; let mut participant_index = 0; @@ -407,7 +407,7 @@ impl Database { tx: &DatabaseTransaction, ) -> Result { let participant_index = self - .get_next_participant_index_internal(room_id, &*tx) + .get_next_participant_index_internal(room_id, tx) .await?; room_participant::Entity::insert_many([room_participant::ActiveModel { @@ -441,12 +441,12 @@ impl Database { ]) .to_owned(), ) - .exec(&*tx) + .exec(tx) .await?; let (channel, room) = self.get_channel_room(room_id, &tx).await?; let channel = channel.ok_or_else(|| anyhow!("no channel for room"))?; - let channel_members = self.get_channel_participants(&channel, &*tx).await?; + let channel_members = self.get_channel_participants(&channel, tx).await?; Ok(JoinRoom { room, channel_id: Some(channel.id), @@ -1042,11 +1042,11 @@ impl Database { tx: &DatabaseTransaction, ) -> Result<()> { let channel = room::Entity::find_by_id(room_id) - .one(&*tx) + .one(tx) .await? .ok_or_else(|| anyhow!("could not find room"))? .find_related(channel::Entity) - .one(&*tx) + .one(tx) .await?; if let Some(channel) = channel { @@ -1057,13 +1057,13 @@ impl Database { .is_in(channel.ancestors()) .and(channel::Column::RequiresZedCla.eq(true)), ) - .count(&*tx) + .count(tx) .await? > 0; if requires_zed_cla { if contributor::Entity::find() .filter(contributor::Column::UserId.eq(user_id)) - .one(&*tx) + .one(tx) .await? .is_none() { @@ -1098,7 +1098,7 @@ impl Database { .eq(connection.owner_id as i32), ), ) - .one(&*tx) + .one(tx) .await?; if let Some(participant) = participant { @@ -1106,7 +1106,7 @@ impl Database { answering_connection_lost: ActiveValue::set(true), ..participant.into_active_model() }) - .exec(&*tx) + .exec(tx) .await?; } Ok(()) @@ -1295,7 +1295,7 @@ impl Database { drop(db_followers); let channel = if let Some(channel_id) = db_room.channel_id { - Some(self.get_channel_internal(channel_id, &*tx).await?) + Some(self.get_channel_internal(channel_id, tx).await?) } else { None }; diff --git a/crates/collab/src/db/queries/servers.rs b/crates/collab/src/db/queries/servers.rs index c79b00eee8..f4e01beba1 100644 --- a/crates/collab/src/db/queries/servers.rs +++ b/crates/collab/src/db/queries/servers.rs @@ -98,7 +98,7 @@ impl Database { .add(server::Column::Environment.eq(environment)) .add(server::Column::Id.ne(new_server_id)), ) - .all(&*tx) + .all(tx) .await?; Ok(stale_servers.into_iter().map(|server| server.id).collect()) } diff --git a/crates/collab/src/db/queries/users.rs b/crates/collab/src/db/queries/users.rs index e60ff63385..f17b43bb98 100644 --- a/crates/collab/src/db/queries/users.rs +++ b/crates/collab/src/db/queries/users.rs @@ -122,7 +122,7 @@ impl Database { metrics_id: ActiveValue::set(Uuid::new_v4()), ..Default::default() }) - .exec_with_returning(&*tx) + .exec_with_returning(tx) .await?; Ok(user) } diff --git a/crates/collab/src/tests/random_project_collaboration_tests.rs b/crates/collab/src/tests/random_project_collaboration_tests.rs index 3cb270e6ef..c1705be8ec 100644 --- a/crates/collab/src/tests/random_project_collaboration_tests.rs +++ b/crates/collab/src/tests/random_project_collaboration_tests.rs @@ -1483,10 +1483,10 @@ fn project_for_root_name( root_name: &str, cx: &TestAppContext, ) -> Option> { - if let Some(ix) = project_ix_for_root_name(&*client.local_projects().deref(), root_name, cx) { + if let Some(ix) = project_ix_for_root_name(client.local_projects().deref(), root_name, cx) { return Some(client.local_projects()[ix].clone()); } - if let Some(ix) = project_ix_for_root_name(&*client.remote_projects().deref(), root_name, cx) { + if let Some(ix) = project_ix_for_root_name(client.remote_projects().deref(), root_name, cx) { return Some(client.remote_projects()[ix].clone()); } None diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index d1324adad0..07ef6a9d84 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -1186,9 +1186,9 @@ pub fn active_match_index( None } else { match ranges.binary_search_by(|probe| { - if probe.end.cmp(cursor, &*buffer).is_lt() { + if probe.end.cmp(cursor, buffer).is_lt() { Ordering::Less - } else if probe.start.cmp(cursor, &*buffer).is_gt() { + } else if probe.start.cmp(cursor, buffer).is_gt() { Ordering::Greater } else { Ordering::Equal diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index e99bb3f193..5248671ad2 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1164,7 +1164,7 @@ impl Pane { matches!( WorkspaceSettings::get_global(cx).autosave, AutosaveSetting::OnFocusChange | AutosaveSetting::OnWindowChange - ) && Self::can_autosave_item(&*item, cx) + ) && Self::can_autosave_item(item, cx) })?; if !will_autosave { let answer = pane.update(cx, |pane, cx| {