chore: Bump Rust edition to 2024 (#27800)

Follow-up to https://github.com/zed-industries/zed/pull/27791

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:55:27 +02:00 committed by GitHub
parent d50905e000
commit dc64ec9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
802 changed files with 3775 additions and 3662 deletions

View file

@ -1,6 +1,6 @@
use crate::Result;
use rpc::proto;
use sea_orm::{entity::prelude::*, DbErr};
use sea_orm::{DbErr, entity::prelude::*};
use serde::{Deserialize, Serialize};
#[macro_export]

View file

@ -1,7 +1,7 @@
use super::*;
use rpc::{
proto::{channel_member::Kind, ChannelBufferVersion, VectorClockEntry},
ErrorCode, ErrorCodeExt,
proto::{ChannelBufferVersion, VectorClockEntry, channel_member::Kind},
};
use sea_orm::{DbBackend, TryGetableMany};

View file

@ -480,7 +480,7 @@ impl Database {
self.notification_kinds_by_id
.iter()
.find(|(_, kind)| **kind == notification_kind)
.map(|kind| kind.0 .0)
.map(|kind| kind.0.0)
}
/// Removes the channel message with the given ID.

View file

@ -1,4 +1,4 @@
use crate::db::{channel_member, ChannelId, ChannelMemberId, ChannelRole, UserId};
use crate::db::{ChannelId, ChannelMemberId, ChannelRole, UserId, channel_member};
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]

View file

@ -20,8 +20,8 @@ use parking_lot::Mutex;
use sea_orm::ConnectionTrait;
use sqlx::migrate::MigrateDatabase;
use std::sync::{
atomic::{AtomicI32, AtomicU32, Ordering::SeqCst},
Arc,
atomic::{AtomicI32, AtomicU32, Ordering::SeqCst},
};
pub struct TestDb {

View file

@ -111,10 +111,11 @@ async fn test_channel_buffers(db: &Arc<Database>) {
assert_eq!(buffer_b.text(), "hello, cruel world");
// Ensure that C fails to open the buffer
assert!(db
.join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 })
.await
.is_err());
assert!(
db.join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 })
.await
.is_err()
);
// Ensure that both collaborators have shown up
assert_eq!(

View file

@ -1,13 +1,13 @@
use crate::{
db::{
tests::{channel_tree, new_test_connection, new_test_user},
Channel, ChannelId, ChannelRole, Database, NewUserParams, RoomId, UserId,
tests::{channel_tree, new_test_connection, new_test_user},
},
test_both_dbs,
};
use rpc::{
proto::{self},
ConnectionId,
proto::{self},
};
use std::sync::Arc;
@ -142,10 +142,11 @@ async fn test_joining_channels(db: &Arc<Database>) {
let room_id = RoomId::from_proto(joined_room.room.id);
drop(joined_room);
// cannot join a room without membership to its channel
assert!(db
.join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },)
.await
.is_err());
assert!(
db.join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },)
.await
.is_err()
);
}
test_both_dbs!(
@ -547,8 +548,8 @@ async fn test_user_is_channel_participant(db: &Arc<Database>) {
db.set_channel_member_role(zed_channel, admin, guest, ChannelRole::Banned)
.await
.unwrap();
assert!(db
.transaction(|tx| async move {
assert!(
db.transaction(|tx| async move {
db.check_user_is_channel_participant(
&db.get_channel_internal(public_channel_id, &tx)
.await
@ -559,7 +560,8 @@ async fn test_user_is_channel_participant(db: &Arc<Database>) {
.await
})
.await
.is_err());
.is_err()
);
let (mut members, _) = db
.get_channel_participant_details(public_channel_id, "", 100, admin)
@ -640,8 +642,8 @@ async fn test_user_is_channel_participant(db: &Arc<Database>) {
})
.await
.unwrap();
assert!(db
.transaction(|tx| async move {
assert!(
db.transaction(|tx| async move {
db.check_user_is_channel_participant(
&db.get_channel_internal(internal_channel_id, &tx)
.await
@ -652,7 +654,8 @@ async fn test_user_is_channel_participant(db: &Arc<Database>) {
.await
})
.await
.is_err(),);
.is_err(),
);
db.transaction(|tx| async move {
db.check_user_is_channel_participant(
@ -720,19 +723,21 @@ async fn test_guest_access(db: &Arc<Database>) {
.await
.unwrap();
assert!(db
.join_channel_chat(zed_channel, guest_connection, guest)
.await
.is_err());
assert!(
db.join_channel_chat(zed_channel, guest_connection, guest)
.await
.is_err()
);
db.join_channel(zed_channel, guest, guest_connection)
.await
.unwrap();
assert!(db
.join_channel_chat(zed_channel, guest_connection, guest)
.await
.is_ok())
assert!(
db.join_channel_chat(zed_channel, guest_connection, guest)
.await
.is_ok()
)
}
#[track_caller]

View file

@ -1,7 +1,7 @@
use super::TestDb;
use crate::db::embedding;
use collections::HashMap;
use sea_orm::{sea_query::Expr, ColumnTrait, EntityTrait, QueryFilter};
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, sea_query::Expr};
use std::ops::Sub;
use time::{Duration, OffsetDateTime, PrimitiveDateTime};

View file

@ -6,7 +6,7 @@ use rpc::ExtensionProvides;
use super::Database;
use crate::db::ExtensionVersionConstraints;
use crate::{
db::{queries::extensions::convert_time_to_chrono, ExtensionMetadata, NewExtensionVersion},
db::{ExtensionMetadata, NewExtensionVersion, queries::extensions::convert_time_to_chrono},
test_both_dbs,
};
@ -162,10 +162,11 @@ async fn test_extensions(db: &Arc<Database>) {
}
// Record download returns false if the extension does not exist.
assert!(!db
.record_extension_download("no-such-extension", "0.0.2")
.await
.unwrap());
assert!(
!db.record_extension_download("no-such-extension", "0.0.2")
.await
.unwrap()
);
// Extensions are returned in descending order of total downloads.
let extensions = db.get_extensions(None, None, 1, 5).await.unwrap();