1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

chore(rust): upgrade to 1.85.0

required for axum 0.8.x
This commit is contained in:
Matthias Ahouansou 2025-06-22 14:19:22 +01:00
parent 3248efbe4b
commit b44b5641f0
No known key found for this signature in database
15 changed files with 35 additions and 44 deletions

View file

@ -19,7 +19,7 @@ repository = "https://gitlab.com/famedly/conduit"
version = "0.11.0-alpha"
# See also `rust-toolchain.toml`
rust-version = "1.83.0"
rust-version = "1.85.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -59,7 +59,7 @@
file = ./rust-toolchain.toml;
# See also `rust-toolchain.toml`
sha256 = "sha256-s1RPtyvDGJaX/BisLT+ifVfuhDT1nZkZ1NcK8sbwELM=";
sha256 = "sha256-AJ6LX/Q/Er9kS15bn9iflkUwcgYqRQxiOIL2ToVAXaU=";
};
});
in

View file

@ -9,7 +9,7 @@
# If you're having trouble making the relevant changes, bug a maintainer.
[toolchain]
channel = "1.83.0"
channel = "1.85.0"
components = [
# For rust-analyzer
"rust-src",

View file

@ -656,7 +656,7 @@ pub async fn joined_members_route(
Ok(joined_members::v3::Response { joined })
}
pub(crate) async fn invite_helper<'a>(
pub(crate) async fn invite_helper(
sender_user: &UserId,
user_id: &UserId,
room_id: &RoomId,

View file

@ -182,11 +182,11 @@ pub async fn login_route(body: Ruma<login::v3::Request>) -> Result<login::v3::Re
let token = utils::random_string(TOKEN_LENGTH);
// Determine if device_id was provided and exists in the db for this user
let device_exists = body.device_id.as_ref().map_or(false, |device_id| {
let device_exists = body.device_id.as_ref().is_some_and(|device_id| {
services()
.users
.all_device_ids(&user_id)
.any(|x| x.as_ref().map_or(false, |v| v == device_id))
.any(|x| x.as_ref().is_ok_and(|v| v == device_id))
});
if device_exists {

View file

@ -818,8 +818,8 @@ async fn load_joined_room(
.ok()
});
let joined_since_last_sync = since_sender_member
.map_or(true, |member| member.membership != MembershipState::Join);
let joined_since_last_sync =
since_sender_member.is_none_or(|member| member.membership != MembershipState::Join);
if since_shortstatehash.is_none() || joined_since_last_sync {
// Probably since = 0, we will do an initial sync
@ -1402,7 +1402,7 @@ pub async fn sync_events_v5_route(
)?;
let joined_since_last_sync = since_sender_member
.map_or(true, |member| member.membership != MembershipState::Join);
.is_none_or(|member| member.membership != MembershipState::Join);
let new_encrypted_room = encrypted_room && since_encryption.is_none();
if encrypted_room {

View file

@ -61,12 +61,11 @@ pub async fn search_users_route(
.rooms
.state_accessor
.room_state_get(&room, &StateEventType::RoomJoinRules, "")
.map_or(false, |event| {
event.map_or(false, |event| {
serde_json::from_str(event.content.get())
.map_or(false, |r: RoomJoinRulesEventContent| {
r.join_rule == JoinRule::Public
})
.is_ok_and(|event| {
event.is_some_and(|event| {
serde_json::from_str(event.content.get()).is_ok_and(
|r: RoomJoinRulesEventContent| r.join_rule == JoinRule::Public,
)
})
})
});

View file

@ -22,10 +22,7 @@ impl service::pusher::Data for KeyValueDatabase {
let mut key = sender.as_bytes().to_vec();
key.push(0xff);
key.extend_from_slice(ids.pushkey.as_bytes());
self.senderkey_pusher
.remove(&key)
.map(|_| ())
.map_err(Into::into)
self.senderkey_pusher.remove(&key).map(|_| ())
}
}
}

View file

@ -221,9 +221,9 @@ impl service::rooms::state_cache::Data for KeyValueDatabase {
.ok();
let in_room = bridge_user_id
.map_or(false, |id| self.is_joined(&id, room_id).unwrap_or(false))
.is_some_and(|id| self.is_joined(&id, room_id).unwrap_or(false))
|| self.room_members(room_id).any(|userid| {
userid.map_or(false, |userid| appservice.users.is_match(userid.as_str()))
userid.is_ok_and(|userid| appservice.users.is_match(userid.as_str()))
});
self.appservice_in_room_cache
@ -273,7 +273,7 @@ impl service::rooms::state_cache::Data for KeyValueDatabase {
}
#[tracing::instrument(skip(self))]
fn server_in_room<'a>(&'a self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
let mut key = server.as_bytes().to_vec();
key.push(0xff);
key.extend_from_slice(room_id.as_bytes());

View file

@ -491,7 +491,7 @@ impl KeyValueDatabase {
for (userid, password) in db.userid_password.iter() {
let password = utils::string_from_bytes(&password);
let empty_hashed_password = password.map_or(false, |password| {
let empty_hashed_password = password.is_ok_and(|password| {
argon2::verify_encoded(&password, b"").unwrap_or(false)
});

View file

@ -87,13 +87,13 @@ impl Service {
let events_after: Vec<_> = relations_until // TODO: should be relations_after
.iter()
.filter(|(_, pdu)| {
filter_event_type.as_ref().map_or(true, |t| &pdu.kind == t)
filter_event_type.as_ref().is_none_or(|t| &pdu.kind == t)
&& if let Ok(content) =
serde_json::from_str::<ExtractRelatesToEventId>(pdu.content.get())
{
filter_rel_type
.as_ref()
.map_or(true, |r| &content.relates_to.rel_type == r)
.is_none_or(|r| &content.relates_to.rel_type == r)
} else {
false
}
@ -135,13 +135,13 @@ impl Service {
let events_before: Vec<_> = relations_until
.iter()
.filter(|(_, pdu)| {
filter_event_type.as_ref().map_or(true, |t| &pdu.kind == t)
filter_event_type.as_ref().is_none_or(|t| &pdu.kind == t)
&& if let Ok(content) =
serde_json::from_str::<ExtractRelatesToEventId>(pdu.content.get())
{
filter_rel_type
.as_ref()
.map_or(true, |r| &content.relates_to.rel_type == r)
.is_none_or(|r| &content.relates_to.rel_type == r)
} else {
false
}

View file

@ -11,17 +11,12 @@ pub struct Service {
impl Service {
#[tracing::instrument(skip(self))]
pub fn index_pdu<'a>(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
pub fn index_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
self.db.index_pdu(shortroomid, pdu_id, message_body)
}
#[tracing::instrument(skip(self))]
pub fn deindex_pdu<'a>(
&self,
shortroomid: u64,
pdu_id: &[u8],
message_body: &str,
) -> Result<()> {
pub fn deindex_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
self.db.deindex_pdu(shortroomid, pdu_id, message_body)
}

View file

@ -629,7 +629,7 @@ fn next_room_to_traverse(
stack: &mut Vec<Vec<(OwnedRoomId, Vec<OwnedServerName>)>>,
parents: &mut VecDeque<OwnedRoomId>,
) -> Option<(OwnedRoomId, Vec<OwnedServerName>)> {
while stack.last().map_or(false, |s| s.is_empty()) {
while stack.last().is_some_and(|s| s.is_empty()) {
stack.pop();
parents.pop_back();
}
@ -663,7 +663,7 @@ async fn get_stripped_space_child_events(
if serde_json::from_str::<SpaceChildEventContent>(pdu.content.get())
.ok()
.map(|c| c.via)
.map_or(true, |v| v.is_empty())
.is_none_or(|v| v.is_empty())
{
continue;
}

View file

@ -171,7 +171,7 @@ impl Service {
})
})
.transpose()?
.map_or(false, |ignored| {
.is_some_and(|ignored| {
ignored
.content
.ignored_users
@ -236,7 +236,7 @@ impl Service {
}
#[tracing::instrument(skip(self))]
pub fn server_in_room<'a>(&'a self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
pub fn server_in_room(&self, server: &ServerName, room_id: &RoomId) -> Result<bool> {
self.db.server_in_room(server, room_id)
}

View file

@ -199,7 +199,7 @@ impl Service {
///
/// Returns pdu id
#[tracing::instrument(skip(self, pdu, pdu_json, leaves))]
pub async fn append_pdu<'a>(
pub async fn append_pdu(
&self,
pdu: &PduEvent,
mut pdu_json: CanonicalJsonObject,
@ -612,8 +612,8 @@ impl Service {
services().globals.server_name() == pdu.sender.server_name()
&& appservice.is_user_match(&pdu.sender)
|| pdu.kind == TimelineEventType::RoomMember
&& pdu.state_key.as_ref().map_or(false, |state_key| {
UserId::parse(state_key).map_or(false, |user_id| {
&& pdu.state_key.as_ref().is_some_and(|state_key| {
UserId::parse(state_key).is_ok_and(|user_id| {
services().globals.server_name() == user_id.server_name()
&& appservice.is_user_match(&user_id)
})
@ -633,8 +633,8 @@ impl Service {
"",
) {
serde_json::from_str::<RoomCanonicalAliasEventContent>(pdu.content.get())
.map_or(false, |content| {
content.alias.map_or(false, |alias| {
.is_ok_and(|content| {
content.alias.is_some_and(|alias| {
appservice.aliases.is_match(alias.as_str())
}) || content
.alt_aliases
@ -1044,7 +1044,7 @@ impl Service {
/// Append the incoming event setting the state snapshot to the state from the
/// server that sent the event.
#[tracing::instrument(skip_all)]
pub async fn append_incoming_pdu<'a>(
pub async fn append_incoming_pdu(
&self,
pdu: &PduEvent,
pdu_json: CanonicalJsonObject,