Tidy up the code (#12116)

Small follow-ups for https://github.com/zed-industries/zed/pull/12063
and https://github.com/zed-industries/zed/pull/12103

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2024-05-22 14:36:15 +03:00 committed by GitHub
parent c440f3a71b
commit c4e87444e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 130 additions and 104 deletions

View file

@ -137,7 +137,7 @@ impl Database {
&self,
id: DevServerId,
name: &str,
ssh_connection_string: &Option<String>,
ssh_connection_string: Option<&str>,
user_id: UserId,
) -> crate::Result<proto::DevServerProjectsUpdate> {
self.transaction(|tx| async move {
@ -150,7 +150,9 @@ impl Database {
dev_server::Entity::update(dev_server::ActiveModel {
name: ActiveValue::Set(name.trim().to_string()),
ssh_connection_string: ActiveValue::Set(ssh_connection_string.clone()),
ssh_connection_string: ActiveValue::Set(
ssh_connection_string.map(ToOwned::to_owned),
),
..dev_server.clone().into_active_model()
})
.exec(&*tx)

View file

@ -2442,7 +2442,7 @@ async fn rename_dev_server(
.rename_dev_server(
dev_server_id,
&request.name,
&request.ssh_connection_string,
request.ssh_connection_string.as_deref(),
session.user_id(),
)
.await?;