Enable clippy::borrow_deref_ref (#8894)

This PR enables the
[`clippy::borrow_deref_ref`](https://rust-lang.github.io/rust-clippy/master/index.html#/borrow_deref_ref)
rule and fixes the outstanding violations.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-05 12:24:54 -05:00 committed by GitHub
parent a25edcc5a8
commit b6af393e6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 67 additions and 68 deletions

View File

@ -371,7 +371,6 @@ style = "allow"
almost_complete_range = "allow" almost_complete_range = "allow"
arc_with_non_send_sync = "allow" arc_with_non_send_sync = "allow"
await_holding_lock = "allow" await_holding_lock = "allow"
borrow_deref_ref = "allow"
borrowed_box = "allow" borrowed_box = "allow"
cast_abs_to_unsigned = "allow" cast_abs_to_unsigned = "allow"
cmp_owned = "allow" cmp_owned = "allow"

View File

@ -308,7 +308,7 @@ impl Database {
connection_lost: ActiveValue::set(true), connection_lost: ActiveValue::set(true),
..Default::default() ..Default::default()
}) })
.exec(&*tx) .exec(tx)
.await?; .await?;
Ok(()) Ok(())
} }
@ -363,7 +363,7 @@ impl Database {
.eq(connection.owner_id as i32), .eq(connection.owner_id as i32),
), ),
) )
.exec(&*tx) .exec(tx)
.await?; .await?;
if result.rows_affected == 0 { if result.rows_affected == 0 {
Err(anyhow!("not a collaborator on this project"))?; Err(anyhow!("not a collaborator on this project"))?;
@ -375,7 +375,7 @@ impl Database {
.filter( .filter(
Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)), Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)),
) )
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(row) = rows.next().await { while let Some(row) = rows.next().await {
let row = row?; let row = row?;
@ -429,7 +429,7 @@ impl Database {
Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)), Condition::all().add(channel_buffer_collaborator::Column::ChannelId.eq(channel_id)),
) )
.into_values::<_, QueryUserIds>() .into_values::<_, QueryUserIds>()
.all(&*tx) .all(tx)
.await?; .await?;
Ok(users) Ok(users)
@ -602,7 +602,7 @@ impl Database {
.select_only() .select_only()
.column(buffer_snapshot::Column::OperationSerializationVersion) .column(buffer_snapshot::Column::OperationSerializationVersion)
.into_values::<_, QueryOperationSerializationVersion>() .into_values::<_, QueryOperationSerializationVersion>()
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!("missing buffer snapshot"))?) .ok_or_else(|| anyhow!("missing buffer snapshot"))?)
} }
@ -617,7 +617,7 @@ impl Database {
..Default::default() ..Default::default()
} }
.find_related(buffer::Entity) .find_related(buffer::Entity)
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!("no such buffer"))?) .ok_or_else(|| anyhow!("no such buffer"))?)
} }
@ -639,7 +639,7 @@ impl Database {
.eq(id) .eq(id)
.and(buffer_snapshot::Column::Epoch.eq(buffer.epoch)), .and(buffer_snapshot::Column::Epoch.eq(buffer.epoch)),
) )
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!("no such snapshot"))?; .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::LamportTimestamp)
.order_by_asc(buffer_operation::Column::ReplicaId) .order_by_asc(buffer_operation::Column::ReplicaId)
.stream(&*tx) .stream(tx)
.await?; .await?;
let mut operations = Vec::new(); let mut operations = Vec::new();
@ -751,7 +751,7 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<Vec<proto::ChannelBufferVersion>> { ) -> Result<Vec<proto::ChannelBufferVersion>> {
let latest_operations = self 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?; .await?;
Ok(latest_operations Ok(latest_operations
@ -781,7 +781,7 @@ impl Database {
observed_buffer_edits::Column::BufferId observed_buffer_edits::Column::BufferId
.is_in(channel_ids_by_buffer_id.keys().copied()), .is_in(channel_ids_by_buffer_id.keys().copied()),
) )
.all(&*tx) .all(tx)
.await?; .await?;
Ok(observed_operations Ok(observed_operations
@ -844,7 +844,7 @@ impl Database {
let stmt = Statement::from_string(self.pool.get_database_backend(), sql); let stmt = Statement::from_string(self.pool.get_database_backend(), sql);
Ok(buffer_operation::Entity::find() Ok(buffer_operation::Entity::find()
.from_raw_sql(stmt) .from_raw_sql(stmt)
.all(&*tx) .all(tx)
.await?) .await?)
} }
} }

View File

@ -441,9 +441,9 @@ impl Database {
user_id: UserId, user_id: UserId,
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<MembershipUpdated> { ) -> Result<MembershipUpdated> {
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 let removed_channels = self
.get_channel_descendants_excluding_self([channel], &*tx) .get_channel_descendants_excluding_self([channel], tx)
.await? .await?
.into_iter() .into_iter()
.map(|channel| channel.id) .map(|channel| channel.id)
@ -564,16 +564,16 @@ impl Database {
let channel_memberships = channel_member::Entity::find() let channel_memberships = channel_member::Entity::find()
.filter(filter) .filter(filter)
.all(&*tx) .all(tx)
.await?; .await?;
let channels = channel::Entity::find() let channels = channel::Entity::find()
.filter(channel::Column::Id.is_in(channel_memberships.iter().map(|m| m.channel_id))) .filter(channel::Column::Id.is_in(channel_memberships.iter().map(|m| m.channel_id)))
.all(&*tx) .all(tx)
.await?; .await?;
let mut descendants = self let mut descendants = self
.get_channel_descendants_excluding_self(channels.iter(), &*tx) .get_channel_descendants_excluding_self(channels.iter(), tx)
.await?; .await?;
for channel in channels { for channel in channels {
@ -614,7 +614,7 @@ impl Database {
.column(room::Column::ChannelId) .column(room::Column::ChannelId)
.column(room_participant::Column::UserId) .column(room_participant::Column::UserId)
.into_values::<_, QueryUserIdsAndChannelIds>() .into_values::<_, QueryUserIdsAndChannelIds>()
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(row) = rows.next().await { while let Some(row) = rows.next().await {
let row: (ChannelId, UserId) = row?; let row: (ChannelId, UserId) = row?;
@ -627,7 +627,7 @@ impl Database {
let mut channel_ids_by_buffer_id = HashMap::default(); let mut channel_ids_by_buffer_id = HashMap::default();
let mut rows = buffer::Entity::find() let mut rows = buffer::Entity::find()
.filter(buffer::Column::ChannelId.is_in(channel_ids.iter().copied())) .filter(buffer::Column::ChannelId.is_in(channel_ids.iter().copied()))
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(row) = rows.next().await { while let Some(row) = rows.next().await {
let row = row?; let row = row?;
@ -636,21 +636,21 @@ impl Database {
drop(rows); drop(rows);
let latest_buffer_versions = self 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?; .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 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?; .await?;
let observed_channel_messages = self let observed_channel_messages = self
.observed_channel_messages(&channel_ids, user_id, &*tx) .observed_channel_messages(&channel_ids, user_id, tx)
.await?; .await?;
let hosted_projects = self 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?; .await?;
Ok(ChannelsForUser { Ok(ChannelsForUser {
@ -778,7 +778,7 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<Vec<UserId>> { ) -> Result<Vec<UserId>> {
let participants = self let participants = self
.get_channel_participant_details_internal(channel, &*tx) .get_channel_participant_details_internal(channel, tx)
.await?; .await?;
Ok(participants Ok(participants
.into_iter() .into_iter()
@ -855,7 +855,7 @@ impl Database {
.filter(channel_member::Column::ChannelId.eq(channel.root_id())) .filter(channel_member::Column::ChannelId.eq(channel.root_id()))
.filter(channel_member::Column::UserId.eq(user_id)) .filter(channel_member::Column::UserId.eq(user_id))
.filter(channel_member::Column::Accepted.eq(false)) .filter(channel_member::Column::Accepted.eq(false))
.one(&*tx) .one(tx)
.await?; .await?;
Ok(row) Ok(row)
@ -875,7 +875,7 @@ impl Database {
.and(channel_member::Column::UserId.eq(user_id)) .and(channel_member::Column::UserId.eq(user_id))
.and(channel_member::Column::Accepted.eq(true)), .and(channel_member::Column::Accepted.eq(true)),
) )
.one(&*tx) .one(tx)
.await?; .await?;
let Some(membership) = membership else { let Some(membership) = membership else {
@ -930,7 +930,7 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<channel::Model> { ) -> Result<channel::Model> {
Ok(channel::Entity::find_by_id(channel_id) Ok(channel::Entity::find_by_id(channel_id)
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| proto::ErrorCode::NoSuchChannel.anyhow())?) .ok_or_else(|| proto::ErrorCode::NoSuchChannel.anyhow())?)
} }
@ -943,7 +943,7 @@ impl Database {
) -> Result<RoomId> { ) -> Result<RoomId> {
let room = room::Entity::find() let room = room::Entity::find()
.filter(room::Column::ChannelId.eq(channel_id)) .filter(room::Column::ChannelId.eq(channel_id))
.one(&*tx) .one(tx)
.await?; .await?;
let room_id = if let Some(room) = room { let room_id = if let Some(room) = room {
@ -954,7 +954,7 @@ impl Database {
live_kit_room: ActiveValue::Set(live_kit_room.to_string()), live_kit_room: ActiveValue::Set(live_kit_room.to_string()),
..Default::default() ..Default::default()
}) })
.exec(&*tx) .exec(tx)
.await?; .await?;
result.last_insert_id result.last_insert_id

View File

@ -11,7 +11,7 @@ impl Database {
) -> Result<Vec<proto::HostedProject>> { ) -> Result<Vec<proto::HostedProject>> {
Ok(hosted_project::Entity::find() Ok(hosted_project::Entity::find()
.filter(hosted_project::Column::ChannelId.is_in(channel_ids.iter().map(|id| id.0))) .filter(hosted_project::Column::ChannelId.is_in(channel_ids.iter().map(|id| id.0)))
.all(&*tx) .all(tx)
.await? .await?
.into_iter() .into_iter()
.flat_map(|project| { .flat_map(|project| {
@ -47,11 +47,11 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<(hosted_project::Model, ChannelRole)> { ) -> Result<(hosted_project::Model, ChannelRole)> {
let project = hosted_project::Entity::find_by_id(hosted_project_id) let project = hosted_project::Entity::find_by_id(hosted_project_id)
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!(ErrorCode::NoSuchProject))?; .ok_or_else(|| anyhow!(ErrorCode::NoSuchProject))?;
let channel = channel::Entity::find_by_id(project.channel_id) let channel = channel::Entity::find_by_id(project.channel_id)
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!(ErrorCode::NoSuchChannel))?; .ok_or_else(|| anyhow!(ErrorCode::NoSuchChannel))?;

View File

@ -171,7 +171,7 @@ impl Database {
.filter(channel_message_mention::Column::MessageId.is_in(messages.iter().map(|m| m.id))) .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::MessageId)
.order_by_asc(channel_message_mention::Column::StartOffset) .order_by_asc(channel_message_mention::Column::StartOffset)
.stream(&*tx) .stream(tx)
.await?; .await?;
let mut message_ix = 0; let mut message_ix = 0;
@ -384,7 +384,7 @@ impl Database {
.to_owned(), .to_owned(),
) )
// TODO: Try to upgrade SeaORM so we don't have to do this hack around their bug // 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?; .await?;
Ok(()) Ok(())
} }
@ -401,7 +401,7 @@ impl Database {
observed_channel_messages::Column::ChannelId observed_channel_messages::Column::ChannelId
.is_in(channel_ids.iter().map(|id| id.0)), .is_in(channel_ids.iter().map(|id| id.0)),
) )
.all(&*tx) .all(tx)
.await?; .await?;
Ok(rows Ok(rows
@ -452,7 +452,7 @@ impl Database {
let stmt = Statement::from_string(self.pool.get_database_backend(), sql); let stmt = Statement::from_string(self.pool.get_database_backend(), sql);
let mut last_messages = channel_message::Model::find_by_statement(stmt) let mut last_messages = channel_message::Model::find_by_statement(stmt)
.stream(&*tx) .stream(tx)
.await?; .await?;
let mut results = Vec::new(); let mut results = Vec::new();

View File

@ -95,7 +95,7 @@ impl Database {
content: ActiveValue::Set(proto.content.clone()), content: ActiveValue::Set(proto.content.clone()),
..Default::default() ..Default::default()
} }
.save(&*tx) .save(tx)
.await?; .await?;
Ok(Some(( Ok(Some((
@ -184,7 +184,7 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<Option<(UserId, proto::Notification)>> { ) -> Result<Option<(UserId, proto::Notification)>> {
if let Some(id) = self if let Some(id) = self
.find_notification(recipient_id, notification, &*tx) .find_notification(recipient_id, notification, tx)
.await? .await?
{ {
let row = notification::Entity::update(notification::ActiveModel { let row = notification::Entity::update(notification::ActiveModel {
@ -236,7 +236,7 @@ impl Database {
}), }),
) )
.into_values::<_, QueryIds>() .into_values::<_, QueryIds>()
.one(&*tx) .one(tx)
.await?) .await?)
} }
} }

View File

@ -186,7 +186,7 @@ impl Database {
.update_column(worktree::Column::RootName) .update_column(worktree::Column::RootName)
.to_owned(), .to_owned(),
) )
.exec(&*tx) .exec(tx)
.await?; .await?;
} }
@ -194,7 +194,7 @@ impl Database {
.filter(worktree::Column::ProjectId.eq(project_id).and( .filter(worktree::Column::ProjectId.eq(project_id).and(
worktree::Column::Id.is_not_in(worktrees.iter().map(|worktree| worktree.id as i64)), worktree::Column::Id.is_not_in(worktrees.iter().map(|worktree| worktree.id as i64)),
)) ))
.exec(&*tx) .exec(tx)
.await?; .await?;
Ok(()) Ok(())
@ -584,7 +584,7 @@ impl Database {
) -> Result<(Project, ReplicaId)> { ) -> Result<(Project, ReplicaId)> {
let mut collaborators = project let mut collaborators = project
.find_related(project_collaborator::Entity) .find_related(project_collaborator::Entity)
.all(&*tx) .all(tx)
.await?; .await?;
let replica_ids = collaborators let replica_ids = collaborators
.iter() .iter()
@ -603,11 +603,11 @@ impl Database {
is_host: ActiveValue::set(false), is_host: ActiveValue::set(false),
..Default::default() ..Default::default()
} }
.insert(&*tx) .insert(tx)
.await?; .await?;
collaborators.push(new_collaborator); 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 let mut worktrees = db_worktrees
.into_iter() .into_iter()
.map(|db_worktree| { .map(|db_worktree| {
@ -637,7 +637,7 @@ impl Database {
.add(worktree_entry::Column::ProjectId.eq(project.id)) .add(worktree_entry::Column::ProjectId.eq(project.id))
.add(worktree_entry::Column::IsDeleted.eq(false)), .add(worktree_entry::Column::IsDeleted.eq(false)),
) )
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(db_entry) = db_entries.next().await { while let Some(db_entry) = db_entries.next().await {
let db_entry = db_entry?; let db_entry = db_entry?;
@ -668,7 +668,7 @@ impl Database {
.add(worktree_repository::Column::ProjectId.eq(project.id)) .add(worktree_repository::Column::ProjectId.eq(project.id))
.add(worktree_repository::Column::IsDeleted.eq(false)), .add(worktree_repository::Column::IsDeleted.eq(false)),
) )
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(db_repository_entry) = db_repository_entries.next().await { while let Some(db_repository_entry) = db_repository_entries.next().await {
let db_repository_entry = db_repository_entry?; let db_repository_entry = db_repository_entry?;
@ -689,7 +689,7 @@ impl Database {
{ {
let mut db_summaries = worktree_diagnostic_summary::Entity::find() let mut db_summaries = worktree_diagnostic_summary::Entity::find()
.filter(worktree_diagnostic_summary::Column::ProjectId.eq(project.id)) .filter(worktree_diagnostic_summary::Column::ProjectId.eq(project.id))
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(db_summary) = db_summaries.next().await { while let Some(db_summary) = db_summaries.next().await {
let db_summary = db_summary?; let db_summary = db_summary?;
@ -710,7 +710,7 @@ impl Database {
{ {
let mut db_settings_files = worktree_settings_file::Entity::find() let mut db_settings_files = worktree_settings_file::Entity::find()
.filter(worktree_settings_file::Column::ProjectId.eq(project.id)) .filter(worktree_settings_file::Column::ProjectId.eq(project.id))
.stream(&*tx) .stream(tx)
.await?; .await?;
while let Some(db_settings_file) = db_settings_files.next().await { while let Some(db_settings_file) = db_settings_files.next().await {
let db_settings_file = db_settings_file?; let db_settings_file = db_settings_file?;
@ -726,7 +726,7 @@ impl Database {
// Populate language servers. // Populate language servers.
let language_servers = project let language_servers = project
.find_related(language_server::Entity) .find_related(language_server::Entity)
.all(&*tx) .all(tx)
.await?; .await?;
let project = Project { let project = Project {

View File

@ -374,7 +374,7 @@ impl Database {
.select_only() .select_only()
.column(room_participant::Column::ParticipantIndex) .column(room_participant::Column::ParticipantIndex)
.into_values::<_, QueryParticipantIndices>() .into_values::<_, QueryParticipantIndices>()
.all(&*tx) .all(tx)
.await?; .await?;
let mut participant_index = 0; let mut participant_index = 0;
@ -407,7 +407,7 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<JoinRoom> { ) -> Result<JoinRoom> {
let participant_index = self let participant_index = self
.get_next_participant_index_internal(room_id, &*tx) .get_next_participant_index_internal(room_id, tx)
.await?; .await?;
room_participant::Entity::insert_many([room_participant::ActiveModel { room_participant::Entity::insert_many([room_participant::ActiveModel {
@ -441,12 +441,12 @@ impl Database {
]) ])
.to_owned(), .to_owned(),
) )
.exec(&*tx) .exec(tx)
.await?; .await?;
let (channel, room) = self.get_channel_room(room_id, &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 = 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 { Ok(JoinRoom {
room, room,
channel_id: Some(channel.id), channel_id: Some(channel.id),
@ -1042,11 +1042,11 @@ impl Database {
tx: &DatabaseTransaction, tx: &DatabaseTransaction,
) -> Result<()> { ) -> Result<()> {
let channel = room::Entity::find_by_id(room_id) let channel = room::Entity::find_by_id(room_id)
.one(&*tx) .one(tx)
.await? .await?
.ok_or_else(|| anyhow!("could not find room"))? .ok_or_else(|| anyhow!("could not find room"))?
.find_related(channel::Entity) .find_related(channel::Entity)
.one(&*tx) .one(tx)
.await?; .await?;
if let Some(channel) = channel { if let Some(channel) = channel {
@ -1057,13 +1057,13 @@ impl Database {
.is_in(channel.ancestors()) .is_in(channel.ancestors())
.and(channel::Column::RequiresZedCla.eq(true)), .and(channel::Column::RequiresZedCla.eq(true)),
) )
.count(&*tx) .count(tx)
.await? .await?
> 0; > 0;
if requires_zed_cla { if requires_zed_cla {
if contributor::Entity::find() if contributor::Entity::find()
.filter(contributor::Column::UserId.eq(user_id)) .filter(contributor::Column::UserId.eq(user_id))
.one(&*tx) .one(tx)
.await? .await?
.is_none() .is_none()
{ {
@ -1098,7 +1098,7 @@ impl Database {
.eq(connection.owner_id as i32), .eq(connection.owner_id as i32),
), ),
) )
.one(&*tx) .one(tx)
.await?; .await?;
if let Some(participant) = participant { if let Some(participant) = participant {
@ -1106,7 +1106,7 @@ impl Database {
answering_connection_lost: ActiveValue::set(true), answering_connection_lost: ActiveValue::set(true),
..participant.into_active_model() ..participant.into_active_model()
}) })
.exec(&*tx) .exec(tx)
.await?; .await?;
} }
Ok(()) Ok(())
@ -1295,7 +1295,7 @@ impl Database {
drop(db_followers); drop(db_followers);
let channel = if let Some(channel_id) = db_room.channel_id { 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 { } else {
None None
}; };

View File

@ -98,7 +98,7 @@ impl Database {
.add(server::Column::Environment.eq(environment)) .add(server::Column::Environment.eq(environment))
.add(server::Column::Id.ne(new_server_id)), .add(server::Column::Id.ne(new_server_id)),
) )
.all(&*tx) .all(tx)
.await?; .await?;
Ok(stale_servers.into_iter().map(|server| server.id).collect()) Ok(stale_servers.into_iter().map(|server| server.id).collect())
} }

View File

@ -122,7 +122,7 @@ impl Database {
metrics_id: ActiveValue::set(Uuid::new_v4()), metrics_id: ActiveValue::set(Uuid::new_v4()),
..Default::default() ..Default::default()
}) })
.exec_with_returning(&*tx) .exec_with_returning(tx)
.await?; .await?;
Ok(user) Ok(user)
} }

View File

@ -1483,10 +1483,10 @@ fn project_for_root_name(
root_name: &str, root_name: &str,
cx: &TestAppContext, cx: &TestAppContext,
) -> Option<Model<Project>> { ) -> Option<Model<Project>> {
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()); 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()); return Some(client.remote_projects()[ix].clone());
} }
None None

View File

@ -1186,9 +1186,9 @@ pub fn active_match_index(
None None
} else { } else {
match ranges.binary_search_by(|probe| { match ranges.binary_search_by(|probe| {
if probe.end.cmp(cursor, &*buffer).is_lt() { if probe.end.cmp(cursor, buffer).is_lt() {
Ordering::Less Ordering::Less
} else if probe.start.cmp(cursor, &*buffer).is_gt() { } else if probe.start.cmp(cursor, buffer).is_gt() {
Ordering::Greater Ordering::Greater
} else { } else {
Ordering::Equal Ordering::Equal

View File

@ -1164,7 +1164,7 @@ impl Pane {
matches!( matches!(
WorkspaceSettings::get_global(cx).autosave, WorkspaceSettings::get_global(cx).autosave,
AutosaveSetting::OnFocusChange | AutosaveSetting::OnWindowChange AutosaveSetting::OnFocusChange | AutosaveSetting::OnWindowChange
) && Self::can_autosave_item(&*item, cx) ) && Self::can_autosave_item(item, cx)
})?; })?;
if !will_autosave { if !will_autosave {
let answer = pane.update(cx, |pane, cx| { let answer = pane.update(cx, |pane, cx| {