chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but hey, it's a start. Release Notes: - N/A
This commit is contained in:
parent
93249fc82b
commit
e6c1c51b37
361 changed files with 3530 additions and 3587 deletions
|
@ -137,7 +137,7 @@ async fn get_authenticated_user(
|
|||
)
|
||||
.await?;
|
||||
let metrics_id = app.db.get_user_metrics_id(user.id).await?;
|
||||
return Ok(Json(AuthenticatedUserResponse { user, metrics_id }));
|
||||
Ok(Json(AuthenticatedUserResponse { user, metrics_id }))
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
|
|
@ -600,7 +600,7 @@ async fn find_or_create_billing_customer(
|
|||
// there's nothing more we need to do.
|
||||
if let Some(billing_customer) = app
|
||||
.db
|
||||
.get_billing_customer_by_stripe_customer_id(&customer_id)
|
||||
.get_billing_customer_by_stripe_customer_id(customer_id)
|
||||
.await?
|
||||
{
|
||||
return Ok(Some(billing_customer));
|
||||
|
@ -609,7 +609,7 @@ async fn find_or_create_billing_customer(
|
|||
// If all we have is a customer ID, resolve it to a full customer record by
|
||||
// hitting the Stripe API.
|
||||
let customer = match customer_or_id {
|
||||
Expandable::Id(id) => Customer::retrieve(&stripe_client, &id, &[]).await?,
|
||||
Expandable::Id(id) => Customer::retrieve(stripe_client, &id, &[]).await?,
|
||||
Expandable::Object(customer) => *customer,
|
||||
};
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ pub async fn post_events(
|
|||
match &wrapper.event {
|
||||
Event::Editor(event) => to_upload.editor_events.push(EditorEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
country_code.clone(),
|
||||
|
@ -410,7 +410,7 @@ pub async fn post_events(
|
|||
.inline_completion_events
|
||||
.push(InlineCompletionEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
country_code.clone(),
|
||||
|
@ -419,7 +419,7 @@ pub async fn post_events(
|
|||
}
|
||||
Event::Call(event) => to_upload.call_events.push(CallEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
|
@ -429,7 +429,7 @@ pub async fn post_events(
|
|||
.assistant_events
|
||||
.push(AssistantEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
|
@ -437,42 +437,42 @@ pub async fn post_events(
|
|||
}
|
||||
Event::Cpu(event) => to_upload.cpu_events.push(CpuEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
)),
|
||||
Event::Memory(event) => to_upload.memory_events.push(MemoryEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
)),
|
||||
Event::App(event) => to_upload.app_events.push(AppEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
)),
|
||||
Event::Setting(event) => to_upload.setting_events.push(SettingEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
)),
|
||||
Event::Edit(event) => to_upload.edit_events.push(EditEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
)),
|
||||
Event::Action(event) => to_upload.action_events.push(ActionEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
|
@ -486,7 +486,7 @@ pub async fn post_events(
|
|||
.extension_events
|
||||
.push(ExtensionEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
metadata,
|
||||
first_event_at,
|
||||
|
@ -495,7 +495,7 @@ pub async fn post_events(
|
|||
}
|
||||
Event::Repl(event) => to_upload.repl_events.push(ReplEventRow::from_event(
|
||||
event.clone(),
|
||||
&wrapper,
|
||||
wrapper,
|
||||
&request_body,
|
||||
first_event_at,
|
||||
checksum_matched,
|
||||
|
@ -1332,7 +1332,7 @@ pub fn calculate_json_checksum(app: Arc<AppState>, json: &impl AsRef<[u8]>) -> O
|
|||
|
||||
let mut summer = Sha256::new();
|
||||
summer.update(checksum_seed);
|
||||
summer.update(&json);
|
||||
summer.update(json);
|
||||
summer.update(checksum_seed);
|
||||
Some(summer.finalize().into_iter().collect())
|
||||
}
|
||||
|
|
|
@ -319,14 +319,14 @@ async fn fetch_extensions_from_blob_store(
|
|||
if let Some(extension) = fetch_extension_manifest(
|
||||
blob_store_client,
|
||||
blob_store_bucket,
|
||||
&extension_id,
|
||||
&published_version,
|
||||
extension_id,
|
||||
published_version,
|
||||
)
|
||||
.await
|
||||
.log_err()
|
||||
{
|
||||
new_versions
|
||||
.entry(&extension_id)
|
||||
.entry(extension_id)
|
||||
.or_default()
|
||||
.push(extension);
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ pub async fn validate_header<B>(mut req: Request<B>, next: Next<B>) -> impl Into
|
|||
impersonator_id: None,
|
||||
})
|
||||
} else {
|
||||
verify_access_token(&access_token, user_id, &state.db).await
|
||||
verify_access_token(access_token, user_id, &state.db).await
|
||||
};
|
||||
|
||||
if let Ok(validate_result) = validate_result {
|
||||
|
@ -202,7 +202,7 @@ pub async fn verify_access_token(
|
|||
.unwrap()
|
||||
});
|
||||
|
||||
let token: AccessTokenJson = serde_json::from_str(&token)?;
|
||||
let token: AccessTokenJson = serde_json::from_str(token)?;
|
||||
|
||||
let db_token = db.get_access_token(token.id).await?;
|
||||
let token_user_id = db_token.impersonated_user_id.unwrap_or(db_token.user_id);
|
||||
|
@ -249,7 +249,7 @@ pub async fn verify_dev_server_token(
|
|||
db: &Arc<Database>,
|
||||
) -> anyhow::Result<dev_server::Model> {
|
||||
let (id, token) = split_dev_server_token(dev_server_token)?;
|
||||
let token_hash = hash_access_token(&token);
|
||||
let token_hash = hash_access_token(token);
|
||||
let server = db.get_dev_server(id).await?;
|
||||
|
||||
if server
|
||||
|
@ -301,18 +301,16 @@ mod test {
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
let token = create_access_token(&db, user.user_id, None).await.unwrap();
|
||||
let token = create_access_token(db, user.user_id, None).await.unwrap();
|
||||
assert!(matches!(
|
||||
verify_access_token(&token, user.user_id, &db)
|
||||
.await
|
||||
.unwrap(),
|
||||
verify_access_token(&token, user.user_id, db).await.unwrap(),
|
||||
VerifyAccessTokenResult {
|
||||
is_valid: true,
|
||||
impersonator_id: None,
|
||||
}
|
||||
));
|
||||
|
||||
let old_token = create_previous_access_token(user.user_id, None, &db)
|
||||
let old_token = create_previous_access_token(user.user_id, None, db)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -333,7 +331,7 @@ mod test {
|
|||
assert!(hash.starts_with("$scrypt$"));
|
||||
|
||||
assert!(matches!(
|
||||
verify_access_token(&old_token, user.user_id, &db)
|
||||
verify_access_token(&old_token, user.user_id, db)
|
||||
.await
|
||||
.unwrap(),
|
||||
VerifyAccessTokenResult {
|
||||
|
@ -355,7 +353,7 @@ mod test {
|
|||
assert!(hash.starts_with("$sha256$"));
|
||||
|
||||
assert!(matches!(
|
||||
verify_access_token(&old_token, user.user_id, &db)
|
||||
verify_access_token(&old_token, user.user_id, db)
|
||||
.await
|
||||
.unwrap(),
|
||||
VerifyAccessTokenResult {
|
||||
|
@ -365,9 +363,7 @@ mod test {
|
|||
));
|
||||
|
||||
assert!(matches!(
|
||||
verify_access_token(&token, user.user_id, &db)
|
||||
.await
|
||||
.unwrap(),
|
||||
verify_access_token(&token, user.user_id, db).await.unwrap(),
|
||||
VerifyAccessTokenResult {
|
||||
is_valid: true,
|
||||
impersonator_id: None,
|
||||
|
|
|
@ -139,14 +139,12 @@ impl Database {
|
|||
let (tx, result) = self.with_weak_transaction(&f).await?;
|
||||
match result {
|
||||
Ok(result) => match tx.commit().await.map_err(Into::into) {
|
||||
Ok(()) => return Ok(result),
|
||||
Err(error) => {
|
||||
return Err(error);
|
||||
}
|
||||
Ok(()) => Ok(result),
|
||||
Err(error) => Err(error),
|
||||
},
|
||||
Err(error) => {
|
||||
tx.rollback().await?;
|
||||
return Err(error);
|
||||
Err(error)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -217,7 +215,7 @@ impl Database {
|
|||
F: Send + Fn(TransactionHandle) -> Fut,
|
||||
Fut: Send + Future<Output = Result<T>>,
|
||||
{
|
||||
let room_id = Database::room_id_for_project(&self, project_id).await?;
|
||||
let room_id = Database::room_id_for_project(self, project_id).await?;
|
||||
let body = async {
|
||||
let mut i = 0;
|
||||
loop {
|
||||
|
|
|
@ -218,9 +218,9 @@ impl From<proto::ChannelRole> for ChannelRole {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<proto::ChannelRole> for ChannelRole {
|
||||
fn into(self) -> proto::ChannelRole {
|
||||
match self {
|
||||
impl From<ChannelRole> for proto::ChannelRole {
|
||||
fn from(val: ChannelRole) -> Self {
|
||||
match val {
|
||||
ChannelRole::Admin => proto::ChannelRole::Admin,
|
||||
ChannelRole::Member => proto::ChannelRole::Member,
|
||||
ChannelRole::Talker => proto::ChannelRole::Talker,
|
||||
|
@ -230,9 +230,9 @@ impl Into<proto::ChannelRole> for ChannelRole {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<i32> for ChannelRole {
|
||||
fn into(self) -> i32 {
|
||||
let proto: proto::ChannelRole = self.into();
|
||||
impl From<ChannelRole> for i32 {
|
||||
fn from(val: ChannelRole) -> Self {
|
||||
let proto: proto::ChannelRole = val.into();
|
||||
proto.into()
|
||||
}
|
||||
}
|
||||
|
@ -259,18 +259,18 @@ impl From<proto::ChannelVisibility> for ChannelVisibility {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<proto::ChannelVisibility> for ChannelVisibility {
|
||||
fn into(self) -> proto::ChannelVisibility {
|
||||
match self {
|
||||
impl From<ChannelVisibility> for proto::ChannelVisibility {
|
||||
fn from(val: ChannelVisibility) -> Self {
|
||||
match val {
|
||||
ChannelVisibility::Public => proto::ChannelVisibility::Public,
|
||||
ChannelVisibility::Members => proto::ChannelVisibility::Members,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<i32> for ChannelVisibility {
|
||||
fn into(self) -> i32 {
|
||||
let proto: proto::ChannelVisibility = self.into();
|
||||
impl From<ChannelVisibility> for i32 {
|
||||
fn from(val: ChannelVisibility) -> Self {
|
||||
let proto: proto::ChannelVisibility = val.into();
|
||||
proto.into()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ impl Database {
|
|||
drop(rows);
|
||||
|
||||
if collaborators.is_empty() {
|
||||
self.snapshot_channel_buffer(channel_id, &tx).await?;
|
||||
self.snapshot_channel_buffer(channel_id, tx).await?;
|
||||
}
|
||||
|
||||
Ok(LeftChannelBuffer {
|
||||
|
|
|
@ -188,17 +188,16 @@ impl Database {
|
|||
.anyhow())?;
|
||||
}
|
||||
}
|
||||
} else if visibility == ChannelVisibility::Members {
|
||||
if self
|
||||
} else if visibility == ChannelVisibility::Members
|
||||
&& self
|
||||
.get_channel_descendants_excluding_self([&channel], &tx)
|
||||
.await?
|
||||
.into_iter()
|
||||
.any(|channel| channel.visibility == ChannelVisibility::Public)
|
||||
{
|
||||
Err(ErrorCode::BadPublicNesting
|
||||
.with_tag("direction", "children")
|
||||
.anyhow())?;
|
||||
}
|
||||
{
|
||||
Err(ErrorCode::BadPublicNesting
|
||||
.with_tag("direction", "children")
|
||||
.anyhow())?;
|
||||
}
|
||||
|
||||
let mut model = channel.into_active_model();
|
||||
|
@ -308,7 +307,7 @@ impl Database {
|
|||
|
||||
fn sanitize_channel_name(name: &str) -> Result<&str> {
|
||||
let new_name = name.trim().trim_start_matches('#');
|
||||
if new_name == "" {
|
||||
if new_name.is_empty() {
|
||||
Err(anyhow!("channel name can't be blank"))?;
|
||||
}
|
||||
Ok(new_name)
|
||||
|
@ -985,7 +984,7 @@ impl Database {
|
|||
.all(&*tx)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|c| Channel::from_model(c))
|
||||
.map(Channel::from_model)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Ok((root_id, channels))
|
||||
|
|
|
@ -86,14 +86,13 @@ impl Database {
|
|||
avoid_duplicates: bool,
|
||||
tx: &DatabaseTransaction,
|
||||
) -> Result<Option<(UserId, proto::Notification)>> {
|
||||
if avoid_duplicates {
|
||||
if self
|
||||
if avoid_duplicates
|
||||
&& self
|
||||
.find_notification(recipient_id, ¬ification, tx)
|
||||
.await?
|
||||
.is_some()
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
{
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let proto = notification.to_proto();
|
||||
|
|
|
@ -459,7 +459,7 @@ impl Database {
|
|||
.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"))?;
|
||||
Ok(JoinRoom {
|
||||
room,
|
||||
|
@ -766,13 +766,13 @@ impl Database {
|
|||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
return Ok(Some(RejoinedProject {
|
||||
Ok(Some(RejoinedProject {
|
||||
id: project_id,
|
||||
old_connection_id,
|
||||
collaborators,
|
||||
worktrees,
|
||||
language_servers,
|
||||
}));
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn leave_room(
|
||||
|
@ -1108,15 +1108,14 @@ impl Database {
|
|||
.count(tx)
|
||||
.await?
|
||||
> 0;
|
||||
if requires_zed_cla {
|
||||
if contributor::Entity::find()
|
||||
if requires_zed_cla
|
||||
&& contributor::Entity::find()
|
||||
.filter(contributor::Column::UserId.eq(user_id))
|
||||
.one(tx)
|
||||
.await?
|
||||
.is_none()
|
||||
{
|
||||
Err(anyhow!("user has not signed the Zed CLA"))?;
|
||||
}
|
||||
{
|
||||
Err(anyhow!("user has not signed the Zed CLA"))?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -48,7 +48,7 @@ impl Model {
|
|||
id: self.id.to_proto(),
|
||||
project_id: project.map(|p| p.id.to_proto()),
|
||||
dev_server_id: self.dev_server_id.to_proto(),
|
||||
path: self.paths().get(0).cloned().unwrap_or_default(),
|
||||
path: self.paths().first().cloned().unwrap_or_default(),
|
||||
paths: self.paths().clone(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,19 +22,17 @@ async fn test_already_processed_stripe_event(db: &Arc<Database>) {
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
assert!(
|
||||
db.already_processed_stripe_event(&processed_event_id)
|
||||
.await
|
||||
.unwrap(),
|
||||
true,
|
||||
"Expected {processed_event_id} to already be processed"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
db.already_processed_stripe_event(&unprocessed_event_id)
|
||||
assert!(
|
||||
!db.already_processed_stripe_event(&unprocessed_event_id)
|
||||
.await
|
||||
.unwrap(),
|
||||
false,
|
||||
"Expected {unprocessed_event_id} to be unprocessed"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -304,10 +304,7 @@ impl AppState {
|
|||
db: db.clone(),
|
||||
live_kit_client,
|
||||
blob_store_client: build_blob_store_client(&config).await.log_err(),
|
||||
stripe_client: build_stripe_client(&config)
|
||||
.await
|
||||
.map(|client| Arc::new(client))
|
||||
.log_err(),
|
||||
stripe_client: build_stripe_client(&config).await.map(Arc::new).log_err(),
|
||||
rate_limiter: Arc::new(RateLimiter::new(db)),
|
||||
executor,
|
||||
clickhouse_client: config
|
||||
|
|
|
@ -141,7 +141,7 @@ async fn validate_api_token<B>(mut req: Request<B>, next: Next<B>) -> impl IntoR
|
|||
})?;
|
||||
|
||||
let state = req.extensions().get::<Arc<LlmState>>().unwrap();
|
||||
match LlmTokenClaims::validate(&token, &state.config) {
|
||||
match LlmTokenClaims::validate(token, &state.config) {
|
||||
Ok(claims) => {
|
||||
if state.db.is_access_token_revoked(&claims.jti).await? {
|
||||
return Err(Error::http(
|
||||
|
@ -154,7 +154,7 @@ async fn validate_api_token<B>(mut req: Request<B>, next: Next<B>) -> impl IntoR
|
|||
.record("user_id", claims.user_id)
|
||||
.record("login", claims.github_user_login.clone())
|
||||
.record("authn.jti", &claims.jti)
|
||||
.record("is_staff", &claims.is_staff);
|
||||
.record("is_staff", claims.is_staff);
|
||||
|
||||
req.extensions_mut().insert(claims);
|
||||
Ok::<_, Error>(next.run(req).await.into_response())
|
||||
|
@ -247,7 +247,7 @@ async fn perform_completion(
|
|||
};
|
||||
|
||||
let mut request: anthropic::Request =
|
||||
serde_json::from_str(¶ms.provider_request.get())?;
|
||||
serde_json::from_str(params.provider_request.get())?;
|
||||
|
||||
// Override the model on the request with the latest version of the model that is
|
||||
// known to the server.
|
||||
|
@ -348,7 +348,7 @@ async fn perform_completion(
|
|||
&state.http_client,
|
||||
open_ai::OPEN_AI_API_URL,
|
||||
api_key,
|
||||
serde_json::from_str(¶ms.provider_request.get())?,
|
||||
serde_json::from_str(params.provider_request.get())?,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
|
@ -379,7 +379,7 @@ async fn perform_completion(
|
|||
&state.http_client,
|
||||
google_ai::API_URL,
|
||||
api_key,
|
||||
serde_json::from_str(¶ms.provider_request.get())?,
|
||||
serde_json::from_str(params.provider_request.get())?,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
|
@ -412,9 +412,9 @@ async fn perform_completion(
|
|||
.context("no Qwen2-7B URL configured on the server")?;
|
||||
let chunks = open_ai::stream_completion(
|
||||
&state.http_client,
|
||||
&api_url,
|
||||
api_url,
|
||||
api_key,
|
||||
serde_json::from_str(¶ms.provider_request.get())?,
|
||||
serde_json::from_str(params.provider_request.get())?,
|
||||
None,
|
||||
)
|
||||
.await?;
|
||||
|
|
|
@ -26,19 +26,16 @@ fn authorize_access_to_model(
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
match provider {
|
||||
LanguageModelProvider::Anthropic => {
|
||||
if model == "claude-3-5-sonnet" {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if claims.has_llm_closed_beta_feature_flag
|
||||
&& Some(model) == config.llm_closed_beta_model_name.as_deref()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
if provider == LanguageModelProvider::Anthropic {
|
||||
if model == "claude-3-5-sonnet" {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if claims.has_llm_closed_beta_feature_flag
|
||||
&& Some(model) == config.llm_closed_beta_model_name.as_deref()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Err(Error::http(
|
||||
|
|
|
@ -110,14 +110,12 @@ impl LlmDatabase {
|
|||
let (tx, result) = self.with_transaction(&f).await?;
|
||||
match result {
|
||||
Ok(result) => match tx.commit().await.map_err(Into::into) {
|
||||
Ok(()) => return Ok(result),
|
||||
Err(error) => {
|
||||
return Err(error);
|
||||
}
|
||||
Ok(()) => Ok(result),
|
||||
Err(error) => Err(error),
|
||||
},
|
||||
Err(error) => {
|
||||
tx.rollback().await?;
|
||||
return Err(error);
|
||||
Err(error)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ impl LlmDatabase {
|
|||
pub async fn insert_models(&mut self, models: &[ModelParams]) -> Result<()> {
|
||||
let all_provider_ids = &self.provider_ids;
|
||||
self.transaction(|tx| async move {
|
||||
model::Entity::insert_many(models.into_iter().map(|model_params| {
|
||||
model::Entity::insert_many(models.iter().map(|model_params| {
|
||||
let provider_id = all_provider_ids[&model_params.provider];
|
||||
model::ActiveModel {
|
||||
provider_id: ActiveValue::set(provider_id),
|
||||
|
|
|
@ -257,7 +257,7 @@ async fn setup_app_database(config: &Config) -> Result<()> {
|
|||
db.initialize_notification_kinds().await?;
|
||||
|
||||
if config.seed_path.is_some() {
|
||||
collab::seed::seed(&config, &db, false).await?;
|
||||
collab::seed::seed(config, &db, false).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -100,7 +100,7 @@ impl RateLimiter {
|
|||
pub async fn save(&self) -> Result<()> {
|
||||
let mut buckets = Vec::new();
|
||||
self.dirty_buckets.retain(|key| {
|
||||
if let Some(bucket) = self.buckets.get(&key) {
|
||||
if let Some(bucket) = self.buckets.get(key) {
|
||||
buckets.push(crate::db::rate_buckets::Model {
|
||||
user_id: key.0,
|
||||
rate_limit_name: key.1.clone(),
|
||||
|
|
|
@ -115,16 +115,16 @@ impl Principal {
|
|||
fn update_span(&self, span: &tracing::Span) {
|
||||
match &self {
|
||||
Principal::User(user) => {
|
||||
span.record("user_id", &user.id.0);
|
||||
span.record("user_id", user.id.0);
|
||||
span.record("login", &user.github_login);
|
||||
}
|
||||
Principal::Impersonated { user, admin } => {
|
||||
span.record("user_id", &user.id.0);
|
||||
span.record("user_id", user.id.0);
|
||||
span.record("login", &user.github_login);
|
||||
span.record("impersonator", &admin.github_login);
|
||||
}
|
||||
Principal::DevServer(dev_server) => {
|
||||
span.record("dev_server_id", &dev_server.id.0);
|
||||
span.record("dev_server_id", dev_server.id.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -964,14 +964,10 @@ impl Server {
|
|||
}
|
||||
};
|
||||
|
||||
let supermaven_client = if let Some(supermaven_admin_api_key) = this.app_state.config.supermaven_admin_api_key.clone() {
|
||||
Some(Arc::new(SupermavenAdminApi::new(
|
||||
let supermaven_client = this.app_state.config.supermaven_admin_api_key.clone().map(|supermaven_admin_api_key| Arc::new(SupermavenAdminApi::new(
|
||||
supermaven_admin_api_key.to_string(),
|
||||
http_client.clone(),
|
||||
)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
)));
|
||||
|
||||
let session = Session {
|
||||
principal: principal.clone(),
|
||||
|
@ -1126,7 +1122,7 @@ impl Server {
|
|||
self.peer.send(connection_id, incoming_call)?;
|
||||
}
|
||||
|
||||
update_user_contacts(user.id, &session).await?;
|
||||
update_user_contacts(user.id, session).await?;
|
||||
}
|
||||
Principal::DevServer(dev_server) => {
|
||||
{
|
||||
|
@ -1159,7 +1155,7 @@ impl Server {
|
|||
.db
|
||||
.dev_server_projects_update(dev_server.user_id)
|
||||
.await?;
|
||||
send_dev_server_projects_update(dev_server.user_id, status, &session).await;
|
||||
send_dev_server_projects_update(dev_server.user_id, status, session).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1564,21 +1560,17 @@ async fn join_room(
|
|||
|
||||
let live_kit_connection_info =
|
||||
if let Some(live_kit) = session.app_state.live_kit_client.as_ref() {
|
||||
if let Some(token) = live_kit
|
||||
live_kit
|
||||
.room_token(
|
||||
&joined_room.room.live_kit_room,
|
||||
&session.user_id().to_string(),
|
||||
)
|
||||
.trace_err()
|
||||
{
|
||||
Some(proto::LiveKitConnectionInfo {
|
||||
.map(|token| proto::LiveKitConnectionInfo {
|
||||
server_url: live_kit.url().into(),
|
||||
token,
|
||||
can_publish: true,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -1863,7 +1855,7 @@ async fn call(
|
|||
initial_project_id,
|
||||
)
|
||||
.await?;
|
||||
room_updated(&room, &session.peer);
|
||||
room_updated(room, &session.peer);
|
||||
mem::take(incoming_call)
|
||||
};
|
||||
update_user_contacts(called_user_id, &session).await?;
|
||||
|
@ -2006,13 +1998,13 @@ async fn share_project(
|
|||
&request.worktrees,
|
||||
request
|
||||
.dev_server_project_id
|
||||
.map(|id| DevServerProjectId::from_proto(id)),
|
||||
.map(DevServerProjectId::from_proto),
|
||||
)
|
||||
.await?;
|
||||
response.send(proto::ShareProjectResponse {
|
||||
project_id: project_id.to_proto(),
|
||||
})?;
|
||||
room_updated(&room, &session.peer);
|
||||
room_updated(room, &session.peer);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -2269,9 +2261,9 @@ async fn leave_project(request: proto::LeaveProject, session: UserSession) -> Re
|
|||
"leave project"
|
||||
);
|
||||
|
||||
project_left(&project, &session);
|
||||
project_left(project, &session);
|
||||
if let Some(room) = room {
|
||||
room_updated(&room, &session.peer);
|
||||
room_updated(room, &session.peer);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -2753,7 +2745,7 @@ async fn shutdown_dev_server_internal(
|
|||
.await
|
||||
.dev_server_projects_update(dev_server.user_id)
|
||||
.await?;
|
||||
send_dev_server_projects_update(dev_server.user_id, status, &session).await;
|
||||
send_dev_server_projects_update(dev_server.user_id, status, session).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -2795,7 +2787,7 @@ async fn update_project(
|
|||
},
|
||||
);
|
||||
if let Some(room) = room {
|
||||
room_updated(&room, &session.peer);
|
||||
room_updated(room, &session.peer);
|
||||
}
|
||||
response.send(proto::Ack {})?;
|
||||
|
||||
|
@ -3562,7 +3554,7 @@ async fn create_channel(
|
|||
) -> Result<()> {
|
||||
let db = session.db().await;
|
||||
|
||||
let parent_id = request.parent_id.map(|id| ChannelId::from_proto(id));
|
||||
let parent_id = request.parent_id.map(ChannelId::from_proto);
|
||||
let (channel, membership) = db
|
||||
.create_channel(&request.name, parent_id, session.user_id())
|
||||
.await?;
|
||||
|
@ -4284,10 +4276,7 @@ async fn send_channel_message(
|
|||
&request.mentions,
|
||||
timestamp,
|
||||
nonce.clone().into(),
|
||||
match request.reply_to_message_id {
|
||||
Some(reply_to_message_id) => Some(MessageId::from_proto(reply_to_message_id)),
|
||||
None => None,
|
||||
},
|
||||
request.reply_to_message_id.map(MessageId::from_proto),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
@ -4848,9 +4837,7 @@ async fn get_notifications(
|
|||
.get_notifications(
|
||||
session.user_id(),
|
||||
NOTIFICATION_COUNT_PER_PAGE,
|
||||
request
|
||||
.before_id
|
||||
.map(|id| db::NotificationId::from_proto(id)),
|
||||
request.before_id.map(db::NotificationId::from_proto),
|
||||
)
|
||||
.await?;
|
||||
response.send(proto::GetNotificationsResponse {
|
||||
|
@ -5104,7 +5091,7 @@ fn build_initial_contacts_update(
|
|||
for contact in contacts {
|
||||
match contact {
|
||||
db::Contact::Accepted { user_id, busy } => {
|
||||
update.contacts.push(contact_for_user(user_id, busy, &pool));
|
||||
update.contacts.push(contact_for_user(user_id, busy, pool));
|
||||
}
|
||||
db::Contact::Outgoing { user_id } => update.outgoing_requests.push(user_id.to_proto()),
|
||||
db::Contact::Incoming { user_id } => {
|
||||
|
@ -5161,7 +5148,8 @@ fn channel_updated(
|
|||
None,
|
||||
pool.channel_connection_ids(channel.root_id())
|
||||
.filter_map(|(channel_id, role)| {
|
||||
role.can_see_channel(channel.visibility).then(|| channel_id)
|
||||
role.can_see_channel(channel.visibility)
|
||||
.then_some(channel_id)
|
||||
}),
|
||||
|peer_id| {
|
||||
peer.send(
|
||||
|
@ -5239,7 +5227,7 @@ async fn lost_dev_server_connection(session: &DevServerSession) -> Result<()> {
|
|||
|
||||
for project_id in project_ids {
|
||||
// not unshare re-checks the connection ids match, so we get away with no transaction
|
||||
unshare_project_internal(project_id, session.connection_id, None, &session).await?;
|
||||
unshare_project_internal(project_id, session.connection_id, None, session).await?;
|
||||
}
|
||||
|
||||
let user_id = session.dev_server().user_id;
|
||||
|
@ -5311,7 +5299,7 @@ async fn leave_room_for_session(session: &UserSession, connection_id: Connection
|
|||
}
|
||||
|
||||
for contact_user_id in contacts_to_update {
|
||||
update_user_contacts(contact_user_id, &session).await?;
|
||||
update_user_contacts(contact_user_id, session).await?;
|
||||
}
|
||||
|
||||
if let Some(live_kit) = session.app_state.live_kit_client.as_ref() {
|
||||
|
|
|
@ -236,7 +236,7 @@ impl ConnectionPool {
|
|||
}
|
||||
PrincipalId::DevServerId(dev_server_id) => {
|
||||
assert_eq!(
|
||||
self.connected_dev_servers.get(&dev_server_id).unwrap(),
|
||||
self.connected_dev_servers.get(dev_server_id).unwrap(),
|
||||
connection_id
|
||||
);
|
||||
}
|
||||
|
@ -300,9 +300,9 @@ impl ChannelPool {
|
|||
}
|
||||
|
||||
pub fn remove_user(&mut self, user_id: &UserId) {
|
||||
if let Some(channels) = self.by_user.remove(&user_id) {
|
||||
if let Some(channels) = self.by_user.remove(user_id) {
|
||||
for channel_id in channels.keys() {
|
||||
self.unsubscribe(user_id, &channel_id)
|
||||
self.unsubscribe(user_id, channel_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ async fn test_core_channel_buffers(
|
|||
|
||||
// Client B sees that client A is gone from the channel buffer.
|
||||
channel_buffer_b.read_with(cx_b, |buffer, _| {
|
||||
assert_collaborators(&buffer.collaborators(), &[client_b.user_id()]);
|
||||
assert_collaborators(buffer.collaborators(), &[client_b.user_id()]);
|
||||
});
|
||||
|
||||
// Client A rejoins the channel buffer
|
||||
|
@ -99,7 +99,7 @@ async fn test_core_channel_buffers(
|
|||
// Sanity test, make sure we saw A rejoining
|
||||
channel_buffer_b.read_with(cx_b, |buffer, _| {
|
||||
assert_collaborators(
|
||||
&buffer.collaborators(),
|
||||
buffer.collaborators(),
|
||||
&[client_a.user_id(), client_b.user_id()],
|
||||
);
|
||||
});
|
||||
|
@ -111,7 +111,7 @@ async fn test_core_channel_buffers(
|
|||
|
||||
// Client B observes A disconnect
|
||||
channel_buffer_b.read_with(cx_b, |buffer, _| {
|
||||
assert_collaborators(&buffer.collaborators(), &[client_b.user_id()]);
|
||||
assert_collaborators(buffer.collaborators(), &[client_b.user_id()]);
|
||||
});
|
||||
|
||||
// TODO:
|
||||
|
@ -687,7 +687,7 @@ fn assert_collaborators(collaborators: &HashMap<PeerId, Collaborator>, ids: &[Op
|
|||
user_ids.sort();
|
||||
assert_eq!(
|
||||
user_ids,
|
||||
ids.into_iter().map(|id| id.unwrap()).collect::<Vec<_>>()
|
||||
ids.iter().map(|id| id.unwrap()).collect::<Vec<_>>()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ async fn test_channel_message_changes(
|
|||
let project_b = client_b.build_empty_local_project(cx_b);
|
||||
let (workspace_b, cx_b) = client_b.build_workspace(&project_b, cx_b);
|
||||
|
||||
let chat_panel_b = workspace_b.update(cx_b, |workspace, cx| ChatPanel::new(workspace, cx));
|
||||
let chat_panel_b = workspace_b.update(cx_b, ChatPanel::new);
|
||||
chat_panel_b
|
||||
.update(cx_b, |chat_panel, cx| {
|
||||
chat_panel.set_active(true, cx);
|
||||
|
|
|
@ -96,7 +96,7 @@ async fn test_dev_server(cx: &mut gpui::TestAppContext, cx2: &mut gpui::TestAppC
|
|||
|
||||
let content = dev_server
|
||||
.fs()
|
||||
.load(&Path::new("/remote/1.txt"))
|
||||
.load(Path::new("/remote/1.txt"))
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(content, "wow!remote\nremote\nremote\n");
|
||||
|
@ -599,7 +599,7 @@ async fn test_save_as_remote(cx1: &mut gpui::TestAppContext, cx2: &mut gpui::Tes
|
|||
let title = remote_workspace
|
||||
.update(&mut cx, |ws, cx| {
|
||||
let active_item = ws.active_item(cx).unwrap();
|
||||
active_item.tab_description(0, &cx).unwrap()
|
||||
active_item.tab_description(0, cx).unwrap()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
@ -607,7 +607,7 @@ async fn test_save_as_remote(cx1: &mut gpui::TestAppContext, cx2: &mut gpui::Tes
|
|||
|
||||
let path = Path::new("/remote/2.txt");
|
||||
assert_eq!(
|
||||
dev_server.fs().load(&path).await.unwrap(),
|
||||
dev_server.fs().load(path).await.unwrap(),
|
||||
"remote\nremote\nremote"
|
||||
);
|
||||
}
|
||||
|
@ -632,12 +632,12 @@ async fn test_new_file_remote(cx1: &mut gpui::TestAppContext, cx2: &mut gpui::Te
|
|||
|
||||
let title = remote_workspace
|
||||
.update(&mut cx, |ws, cx| {
|
||||
ws.active_item(cx).unwrap().tab_description(0, &cx).unwrap()
|
||||
ws.active_item(cx).unwrap().tab_description(0, cx).unwrap()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(title, "2.txt");
|
||||
|
||||
let path = Path::new("/remote/2.txt");
|
||||
assert_eq!(dev_server.fs().load(&path).await.unwrap(), "new!");
|
||||
assert_eq!(dev_server.fs().load(path).await.unwrap(), "new!");
|
||||
}
|
||||
|
|
|
@ -2109,7 +2109,7 @@ struct Row10;"#};
|
|||
editor_cx_a.update_editor(|editor, cx| {
|
||||
let snapshot = editor.snapshot(cx);
|
||||
let all_hunks = editor_hunks(editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(&editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(editor, &snapshot, cx);
|
||||
assert_eq!(expanded_hunks_background_highlights(editor, cx), Vec::new());
|
||||
assert_eq!(
|
||||
all_hunks,
|
||||
|
@ -2146,7 +2146,7 @@ struct Row10;"#};
|
|||
editor_cx_b.update_editor(|editor, cx| {
|
||||
let snapshot = editor.snapshot(cx);
|
||||
let all_hunks = editor_hunks(editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(&editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(editor, &snapshot, cx);
|
||||
assert_eq!(
|
||||
expanded_hunks_background_highlights(editor, cx),
|
||||
vec![DisplayRow(1)..=DisplayRow(2), DisplayRow(8)..=DisplayRow(8)],
|
||||
|
@ -2194,7 +2194,7 @@ struct Row10;"#};
|
|||
editor_cx_a.update_editor(|editor, cx| {
|
||||
let snapshot = editor.snapshot(cx);
|
||||
let all_hunks = editor_hunks(editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(&editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(editor, &snapshot, cx);
|
||||
assert_eq!(expanded_hunks_background_highlights(editor, cx), Vec::new());
|
||||
assert_eq!(
|
||||
all_hunks,
|
||||
|
@ -2209,7 +2209,7 @@ struct Row10;"#};
|
|||
editor_cx_b.update_editor(|editor, cx| {
|
||||
let snapshot = editor.snapshot(cx);
|
||||
let all_hunks = editor_hunks(editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(&editor, &snapshot, cx);
|
||||
let all_expanded_hunks = expanded_hunks(editor, &snapshot, cx);
|
||||
assert_eq!(
|
||||
expanded_hunks_background_highlights(editor, cx),
|
||||
vec![DisplayRow(5)..=DisplayRow(5)]
|
||||
|
|
|
@ -506,7 +506,7 @@ async fn test_basic_following(
|
|||
|
||||
// Client B activates an item that doesn't implement following,
|
||||
// so the previously-opened screen-sharing item gets activated.
|
||||
let unfollowable_item = cx_b.new_view(|cx| TestItem::new(cx));
|
||||
let unfollowable_item = cx_b.new_view(TestItem::new);
|
||||
workspace_b.update(cx_b, |workspace, cx| {
|
||||
workspace.active_pane().update(cx, |pane, cx| {
|
||||
pane.add_item(Box::new(unfollowable_item), true, true, None, cx)
|
||||
|
|
|
@ -538,10 +538,7 @@ async fn test_joining_channels_and_calling_multiple_users_simultaneously(
|
|||
|
||||
// Leave the room
|
||||
active_call_a
|
||||
.update(cx_a, |call, cx| {
|
||||
let hang_up = call.hang_up(cx);
|
||||
hang_up
|
||||
})
|
||||
.update(cx_a, |call, cx| call.hang_up(cx))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -574,10 +571,7 @@ async fn test_joining_channels_and_calling_multiple_users_simultaneously(
|
|||
|
||||
// Leave the room
|
||||
active_call_a
|
||||
.update(cx_a, |call, cx| {
|
||||
let hang_up = call.hang_up(cx);
|
||||
hang_up
|
||||
})
|
||||
.update(cx_a, |call, cx| call.hang_up(cx))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
@ -2578,7 +2572,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(1..2, "", "two\n")],
|
||||
);
|
||||
|
@ -2602,7 +2596,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(1..2, "", "two\n")],
|
||||
);
|
||||
|
@ -2626,7 +2620,7 @@ async fn test_git_diff_base_change(
|
|||
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(2..3, "", "three\n")],
|
||||
);
|
||||
|
@ -2641,7 +2635,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(2..3, "", "three\n")],
|
||||
);
|
||||
|
@ -2684,7 +2678,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(1..2, "", "two\n")],
|
||||
);
|
||||
|
@ -2708,7 +2702,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(1..2, "", "two\n")],
|
||||
);
|
||||
|
@ -2741,7 +2735,7 @@ async fn test_git_diff_base_change(
|
|||
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(2..3, "", "three\n")],
|
||||
);
|
||||
|
@ -2756,7 +2750,7 @@ async fn test_git_diff_base_change(
|
|||
);
|
||||
git::diff::assert_hunks(
|
||||
buffer.snapshot().git_diff_hunks_in_row_range(0..4),
|
||||
&buffer,
|
||||
buffer,
|
||||
&diff_base,
|
||||
&[(2..3, "", "three\n")],
|
||||
);
|
||||
|
@ -2884,8 +2878,8 @@ async fn test_git_status_sync(
|
|||
client_a.fs().set_status_for_repo_via_git_operation(
|
||||
Path::new("/dir/.git"),
|
||||
&[
|
||||
(&Path::new(A_TXT), GitFileStatus::Added),
|
||||
(&Path::new(B_TXT), GitFileStatus::Added),
|
||||
(Path::new(A_TXT), GitFileStatus::Added),
|
||||
(Path::new(B_TXT), GitFileStatus::Added),
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -2932,8 +2926,8 @@ async fn test_git_status_sync(
|
|||
client_a.fs().set_status_for_repo_via_working_copy_change(
|
||||
Path::new("/dir/.git"),
|
||||
&[
|
||||
(&Path::new(A_TXT), GitFileStatus::Modified),
|
||||
(&Path::new(B_TXT), GitFileStatus::Modified),
|
||||
(Path::new(A_TXT), GitFileStatus::Modified),
|
||||
(Path::new(B_TXT), GitFileStatus::Modified),
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -6336,7 +6330,7 @@ async fn test_preview_tabs(cx: &mut TestAppContext) {
|
|||
|
||||
// Close permanent tab
|
||||
pane.update(cx, |pane, cx| {
|
||||
let id = pane.items().nth(0).unwrap().item_id();
|
||||
let id = pane.items().next().unwrap().item_id();
|
||||
pane.close_item_by_id(id, workspace::SaveIntent::Skip, cx)
|
||||
})
|
||||
.await
|
||||
|
@ -6347,7 +6341,7 @@ async fn test_preview_tabs(cx: &mut TestAppContext) {
|
|||
assert_eq!(get_path(pane, 0, cx), path_1.clone());
|
||||
assert_eq!(
|
||||
pane.preview_item_id(),
|
||||
Some(pane.items().nth(0).unwrap().item_id())
|
||||
Some(pane.items().next().unwrap().item_id())
|
||||
);
|
||||
|
||||
assert!(pane.can_navigate_backward());
|
||||
|
@ -6366,7 +6360,7 @@ async fn test_preview_tabs(cx: &mut TestAppContext) {
|
|||
assert_eq!(get_path(pane, 0, cx), path_1.clone());
|
||||
assert_eq!(
|
||||
pane.preview_item_id(),
|
||||
Some(pane.items().nth(0).unwrap().item_id())
|
||||
Some(pane.items().next().unwrap().item_id())
|
||||
);
|
||||
|
||||
assert!(pane.can_navigate_backward());
|
||||
|
@ -6395,7 +6389,7 @@ async fn test_preview_tabs(cx: &mut TestAppContext) {
|
|||
assert_eq!(get_path(pane, 0, cx), path_1.clone());
|
||||
assert_eq!(
|
||||
pane.preview_item_id(),
|
||||
Some(pane.items().nth(0).unwrap().item_id())
|
||||
Some(pane.items().next().unwrap().item_id())
|
||||
);
|
||||
|
||||
assert!(pane.can_navigate_backward());
|
||||
|
@ -6433,7 +6427,7 @@ async fn test_preview_tabs(cx: &mut TestAppContext) {
|
|||
assert_eq!(get_path(pane, 0, cx), path_2.clone());
|
||||
assert_eq!(
|
||||
pane.preview_item_id(),
|
||||
Some(pane.items().nth(0).unwrap().item_id())
|
||||
Some(pane.items().next().unwrap().item_id())
|
||||
);
|
||||
|
||||
assert!(pane.can_navigate_backward());
|
||||
|
|
|
@ -282,7 +282,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
let mut paths = client.fs().paths(false);
|
||||
paths.remove(0);
|
||||
let new_root_path = if paths.is_empty() || rng.gen() {
|
||||
Path::new("/").join(&plan.next_root_dir_name())
|
||||
Path::new("/").join(plan.next_root_dir_name())
|
||||
} else {
|
||||
paths.choose(rng).unwrap().clone()
|
||||
};
|
||||
|
|
|
@ -263,8 +263,7 @@ impl TestServer {
|
|||
})
|
||||
});
|
||||
|
||||
let git_hosting_provider_registry =
|
||||
cx.update(|cx| GitHostingProviderRegistry::default_global(cx));
|
||||
let git_hosting_provider_registry = cx.update(GitHostingProviderRegistry::default_global);
|
||||
git_hosting_provider_registry
|
||||
.register_hosting_provider(Arc::new(git_hosting_providers::Github));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue