Update to edition 2024

This commit is contained in:
Xiretza 2025-02-21 22:45:26 +00:00
parent e9f4381e38
commit 61c9a3165f
5 changed files with 18 additions and 18 deletions

View file

@ -1,8 +1,8 @@
[package] [package]
name = "its-matrix-bot" name = "its-matrix-bot"
version = "0.2.0" version = "0.2.0"
edition = "2021" edition = "2024"
rust-version = "1.84" rust-version = "1.85"
description = "IT-Syndikat matrix bot" description = "IT-Syndikat matrix bot"
repository = "https://git.it-syndikat.org/IT-Syndikat/its-matrix-bot" repository = "https://git.it-syndikat.org/IT-Syndikat/its-matrix-bot"

View file

@ -6,14 +6,16 @@ use std::{
}; };
use color_eyre::{ use color_eyre::{
eyre::{bail, eyre, Context},
Help, Result, Help, Result,
eyre::{Context, bail, eyre},
}; };
use matrix_sdk::{ use matrix_sdk::{
Client, RoomState,
config::SyncSettings, config::SyncSettings,
event_handler::Ctx, event_handler::Ctx,
room::Room, room::Room,
ruma::{ ruma::{
OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch,
api::client::receipt::create_receipt::v3::ReceiptType, api::client::receipt::create_receipt::v3::ReceiptType,
events::{ events::{
receipt::ReceiptThread, receipt::ReceiptThread,
@ -25,23 +27,21 @@ use matrix_sdk::{
}, },
}, },
}, },
OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch,
}, },
Client, RoomState,
}; };
use never_say_never::Never; use never_say_never::Never;
use reqwest::Url; use reqwest::Url;
use serde::Deserialize; use serde::Deserialize;
use time::{ use time::{
OffsetDateTime, UtcOffset,
convert::{Day, Hour, Minute, Second}, convert::{Day, Hour, Minute, Second},
ext::NumericalDuration, ext::NumericalDuration,
macros::format_description, macros::format_description,
OffsetDateTime, UtcOffset,
}; };
use tokio::time::sleep; use tokio::time::sleep;
use tracing::{event, info, instrument, span, Level}; use tracing::{Level, event, info, instrument, span};
use crate::{its_api::ItsApi, session_path, sqlite_store_path, SessionData}; use crate::{SessionData, its_api::ItsApi, session_path, sqlite_store_path};
const STATE_POLLING_FREQUENCY: Duration = Duration::from_secs(10); const STATE_POLLING_FREQUENCY: Duration = Duration::from_secs(10);
@ -455,9 +455,9 @@ impl Bot {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use time::{macros::datetime, Duration, UtcOffset}; use time::{Duration, UtcOffset, macros::datetime};
use super::{format_isitopen_response, OpenState}; use super::{OpenState, format_isitopen_response};
#[test] #[test]
fn test_format_isitopen_response() { fn test_format_isitopen_response() {

View file

@ -1,7 +1,7 @@
use reqwest::{Client, Url}; use reqwest::{Client, Url};
use serde::Deserialize; use serde::Deserialize;
use thiserror::Error; use thiserror::Error;
use tracing::{event, instrument, Level}; use tracing::{Level, event, instrument};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {

View file

@ -12,10 +12,10 @@ use std::path::{Path, PathBuf};
use bot::{Bot, Config}; use bot::{Bot, Config};
use clap::Parser as _; use clap::Parser as _;
use color_eyre::{eyre::Context, Result}; use color_eyre::{Result, eyre::Context};
use matrix_sdk::authentication::matrix::MatrixSession; use matrix_sdk::authentication::matrix::MatrixSession;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::{event, instrument, Level}; use tracing::{Level, event, instrument};
use xdg::BaseDirectories; use xdg::BaseDirectories;
mod bot; mod bot;
@ -96,7 +96,7 @@ async fn load_config(path: &Path) -> Result<Config> {
fn install_tracing() { fn install_tracing() {
use tracing_subscriber::{ use tracing_subscriber::{
prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt, EnvFilter, EnvFilter, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
}; };
let fmt_layer = tracing_subscriber::fmt::layer().with_target(false); let fmt_layer = tracing_subscriber::fmt::layer().with_target(false);

View file

@ -2,17 +2,17 @@ use std::io::Write;
use clap::Args; use clap::Args;
use color_eyre::{ use color_eyre::{
eyre::{bail, eyre, OptionExt},
Result, Result,
eyre::{OptionExt, bail, eyre},
}; };
use futures::StreamExt; use futures::StreamExt;
use matrix_sdk::{ use matrix_sdk::{
Client,
authentication::matrix::MatrixSession, authentication::matrix::MatrixSession,
config::SyncSettings, config::SyncSettings,
crypto::{format_emojis, SasState}, crypto::{SasState, format_emojis},
encryption::verification::{Verification, VerificationRequestState}, encryption::verification::{Verification, VerificationRequestState},
ruma::{events::key::verification::VerificationMethod, UserId}, ruma::{UserId, events::key::verification::VerificationMethod},
Client,
}; };
use tokio::io::{AsyncBufReadExt, BufReader, Lines, Stdin}; use tokio::io::{AsyncBufReadExt, BufReader, Lines, Stdin};
use tokio_util::task::AbortOnDropHandle; use tokio_util::task::AbortOnDropHandle;