Update to rust 1.89 and edition 2024

This commit is contained in:
2025-08-28 00:57:02 +02:00
parent 01e88eeb3b
commit c5262dcf35
29 changed files with 68 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
[package]
name = "automation_lib"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
automation_macro = { workspace = true }

View File

@@ -2,8 +2,8 @@ use std::collections::HashMap;
use std::pin::Pin;
use std::sync::Arc;
use futures::future::join_all;
use futures::Future;
use futures::future::join_all;
use tokio::sync::{RwLock, RwLockReadGuard};
use tokio_cron_scheduler::{Job, JobScheduler};
use tracing::{debug, instrument, trace};
@@ -64,7 +64,7 @@ impl DeviceManager {
self.devices.read().await.get(name).cloned()
}
pub async fn devices(&self) -> RwLockReadGuard<DeviceMap> {
pub async fn devices(&self) -> RwLockReadGuard<'_, DeviceMap> {
self.devices.read().await
}

View File

@@ -38,7 +38,9 @@ impl fmt::Display for MissingEnv {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Missing environment variable")?;
if self.keys.is_empty() {
unreachable!("This error should only be returned if there are actually missing environment variables");
unreachable!(
"This error should only be returned if there are actually missing environment variables"
);
}
if self.keys.len() == 1 {
write!(f, " '{}'", self.keys[0])?;

View File

@@ -1,6 +1,5 @@
#![allow(incomplete_features)]
#![feature(specialization)]
#![feature(let_chains)]
pub mod action_callback;
pub mod config;

View File

@@ -9,7 +9,7 @@ use serde::Serialize;
use serde_repr::*;
use tracing::{error, trace, warn};
use crate::device::{impl_device, Device, LuaDeviceCreate};
use crate::device::{Device, LuaDeviceCreate, impl_device};
use crate::event::{self, Event, EventChannel, OnNotification, OnPresence};
#[derive(Debug, Serialize_repr, Clone, Copy)]

View File

@@ -10,7 +10,7 @@ use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use tracing::{debug, trace, warn};
use crate::config::MqttDeviceConfig;
use crate::device::{impl_device, Device, LuaDeviceCreate};
use crate::device::{Device, LuaDeviceCreate, impl_device};
use crate::event::{self, Event, EventChannel, OnMqtt};
use crate::messages::PresenceMessage;
use crate::mqtt::WrappedAsyncClient;
@@ -40,11 +40,11 @@ pub struct Presence {
}
impl Presence {
async fn state(&self) -> RwLockReadGuard<State> {
async fn state(&self) -> RwLockReadGuard<'_, State> {
self.state.read().await
}
async fn state_mut(&self) -> RwLockWriteGuard<State> {
async fn state_mut(&self) -> RwLockWriteGuard<'_, State> {
self.state.write().await
}
}