From 61c9a3165f619229436a15b0c1bcf4e1ed8aec53 Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> Date: Fri, 21 Feb 2025 22:45:26 +0000 Subject: [PATCH] Update to edition 2024 --- Cargo.toml | 4 ++-- src/bot.rs | 16 ++++++++-------- src/its_api.rs | 2 +- src/main.rs | 6 +++--- src/setup.rs | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d097a53..1080a8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "its-matrix-bot" version = "0.2.0" -edition = "2021" -rust-version = "1.84" +edition = "2024" +rust-version = "1.85" description = "IT-Syndikat matrix bot" repository = "https://git.it-syndikat.org/IT-Syndikat/its-matrix-bot" diff --git a/src/bot.rs b/src/bot.rs index 068fb0f..83f9988 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -6,14 +6,16 @@ use std::{ }; use color_eyre::{ - eyre::{bail, eyre, Context}, Help, Result, + eyre::{Context, bail, eyre}, }; use matrix_sdk::{ + Client, RoomState, config::SyncSettings, event_handler::Ctx, room::Room, ruma::{ + OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch, api::client::receipt::create_receipt::v3::ReceiptType, events::{ receipt::ReceiptThread, @@ -25,23 +27,21 @@ use matrix_sdk::{ }, }, }, - OwnedRoomOrAliasId, RoomAliasId, RoomId, RoomOrAliasId, SecondsSinceUnixEpoch, }, - Client, RoomState, }; use never_say_never::Never; use reqwest::Url; use serde::Deserialize; use time::{ + OffsetDateTime, UtcOffset, convert::{Day, Hour, Minute, Second}, ext::NumericalDuration, macros::format_description, - OffsetDateTime, UtcOffset, }; 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); @@ -455,9 +455,9 @@ impl Bot { #[cfg(test)] 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] fn test_format_isitopen_response() { diff --git a/src/its_api.rs b/src/its_api.rs index ed3eebb..f9dc327 100644 --- a/src/its_api.rs +++ b/src/its_api.rs @@ -1,7 +1,7 @@ use reqwest::{Client, Url}; use serde::Deserialize; use thiserror::Error; -use tracing::{event, instrument, Level}; +use tracing::{Level, event, instrument}; #[derive(Debug, Error)] pub enum Error { diff --git a/src/main.rs b/src/main.rs index 12158d0..a340c5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,10 +12,10 @@ use std::path::{Path, PathBuf}; use bot::{Bot, Config}; use clap::Parser as _; -use color_eyre::{eyre::Context, Result}; +use color_eyre::{Result, eyre::Context}; use matrix_sdk::authentication::matrix::MatrixSession; use serde::{Deserialize, Serialize}; -use tracing::{event, instrument, Level}; +use tracing::{Level, event, instrument}; use xdg::BaseDirectories; mod bot; @@ -96,7 +96,7 @@ async fn load_config(path: &Path) -> Result<Config> { fn install_tracing() { 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); diff --git a/src/setup.rs b/src/setup.rs index c11f0c8..42898ab 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -2,17 +2,17 @@ use std::io::Write; use clap::Args; use color_eyre::{ - eyre::{bail, eyre, OptionExt}, Result, + eyre::{OptionExt, bail, eyre}, }; use futures::StreamExt; use matrix_sdk::{ + Client, authentication::matrix::MatrixSession, config::SyncSettings, - crypto::{format_emojis, SasState}, + crypto::{SasState, format_emojis}, encryption::verification::{Verification, VerificationRequestState}, - ruma::{events::key::verification::VerificationMethod, UserId}, - Client, + ruma::{UserId, events::key::verification::VerificationMethod}, }; use tokio::io::{AsyncBufReadExt, BufReader, Lines, Stdin}; use tokio_util::task::AbortOnDropHandle;