fix: rust 1.95.0 clippy lints and matrix-sdk 0.17 API changes

Toolchain bump surfaced new lints (derivable_impls,
unnecessary_unwrap, unnecessary_sort_by, while_let_loop,
collapsible_match, unnecessary_option_map_or_else, cmp_owned)
across bft-json-crdt and huskies-server. All fixed mechanically.

Cargo.toml: dropped the no-longer-existing `rustls-tls` matrix-sdk
feature, then chased through the 0.17 API breakage:
- Relation::Reply is now a tuple variant wrapping Reply, not a
  struct variant with `in_reply_to`
- UserIdentifier::UserIdOrLocalpart removed — use
  UserIdentifier::Matrix(MatrixUserIdentifier::new(..))
- SendMessageLikeEventResult no longer exposes event_id directly;
  it's now on the inner `response` field

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-05-14 14:48:49 +01:00
parent 995c878961
commit 8625b9a7fc
13 changed files with 275 additions and 317 deletions
@@ -61,7 +61,7 @@ pub(super) async fn is_reply_to_bot(
bot_sent_event_ids: &TokioMutex<HashSet<OwnedEventId>>,
) -> bool {
let candidate_ids: Vec<&OwnedEventId> = match relates_to {
Some(Relation::Reply { in_reply_to }) => vec![&in_reply_to.event_id],
Some(Relation::Reply(reply)) => vec![&reply.in_reply_to.event_id],
Some(Relation::Thread(thread)) => {
let mut ids = vec![&thread.event_id];
if let Some(irti) = &thread.in_reply_to {
@@ -216,8 +216,9 @@ mod tests {
sent.lock().await.insert(event_id.clone());
let in_reply_to = matrix_sdk::ruma::events::relation::InReplyTo::new(event_id);
let relates_to: Option<Relation<RoomMessageEventContentWithoutRelation>> =
Some(Relation::Reply { in_reply_to });
let relates_to: Option<Relation<RoomMessageEventContentWithoutRelation>> = Some(
Relation::Reply(matrix_sdk::ruma::events::relation::Reply::new(in_reply_to)),
);
assert!(is_reply_to_bot(relates_to.as_ref(), &sent).await);
}
@@ -231,8 +232,9 @@ mod tests {
let in_reply_to = matrix_sdk::ruma::events::relation::InReplyTo::new(
"$other:example.com".parse::<OwnedEventId>().unwrap(),
);
let relates_to: Option<Relation<RoomMessageEventContentWithoutRelation>> =
Some(Relation::Reply { in_reply_to });
let relates_to: Option<Relation<RoomMessageEventContentWithoutRelation>> = Some(
Relation::Reply(matrix_sdk::ruma::events::relation::Reply::new(in_reply_to)),
);
assert!(!is_reply_to_bot(relates_to.as_ref(), &sent).await);
}
+3 -1
View File
@@ -92,7 +92,9 @@ pub async fn run_bot(
{
use matrix_sdk::ruma::api::client::uiaa;
let password_auth = uiaa::AuthData::Password(uiaa::Password::new(
uiaa::UserIdentifier::UserIdOrLocalpart(config.username.clone().unwrap_or_default()),
uiaa::UserIdentifier::Matrix(uiaa::MatrixUserIdentifier::new(
config.username.clone().unwrap_or_default(),
)),
config.password.clone().unwrap_or_default(),
));
if let Err(e) = client
@@ -48,7 +48,7 @@ impl ChatTransport for MatrixTransport {
.await
.map_err(|e| format!("Matrix send error: {e}"))?;
Ok(resp.event_id.to_string())
Ok(resp.response.event_id.to_string())
}
async fn edit_message(