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

@@ -68,11 +68,11 @@ pub struct ContactSensor {
}
impl ContactSensor {
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
}
}

View File

@@ -5,7 +5,7 @@ use automation_lib::device::{Device, LuaDeviceCreate};
use automation_lib::event::OnMqtt;
use automation_lib::mqtt::WrappedAsyncClient;
use automation_macro::LuaDeviceConfig;
use rumqttc::{matches, Publish};
use rumqttc::{Publish, matches};
use serde::Deserialize;
use tracing::{debug, trace, warn};

View File

@@ -6,7 +6,7 @@ use automation_lib::messages::{RemoteAction, RemoteMessage};
use automation_lib::mqtt::WrappedAsyncClient;
use automation_macro::LuaDeviceConfig;
use axum::async_trait;
use rumqttc::{matches, Publish};
use rumqttc::{Publish, matches};
use tracing::{debug, error, trace};
#[derive(Debug, Clone, LuaDeviceConfig)]

View File

@@ -38,11 +38,11 @@ pub struct LightSensor {
}
impl LightSensor {
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
}
}
@@ -99,9 +99,7 @@ impl OnMqtt for LightSensor {
let is_dark = self.state().await.is_dark;
trace!(
"In between min ({}) and max ({}) value, keeping current state: {}",
self.config.min,
self.config.max,
is_dark
self.config.min, self.config.max, is_dark
);
is_dark
};

View File

@@ -38,11 +38,11 @@ pub struct Washer {
}
impl Washer {
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
}
}

View File

@@ -15,7 +15,7 @@ use google_home::device;
use google_home::errors::ErrorCode;
use google_home::traits::{Brightness, Color, ColorSetting, ColorTemperatureRange, OnOff};
use google_home::types::Type;
use rumqttc::{matches, Publish};
use rumqttc::{Publish, matches};
use serde::{Deserialize, Serialize};
use serde_json::json;
use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
@@ -100,11 +100,11 @@ pub type LightBrightness = Light<StateBrightness>;
pub type LightColorTemperature = Light<StateColorTemperature>;
impl<T: LightState> Light<T> {
async fn state(&self) -> RwLockReadGuard<T> {
async fn state(&self) -> RwLockReadGuard<'_, T> {
self.state.read().await
}
async fn state_mut(&self) -> RwLockWriteGuard<T> {
async fn state_mut(&self) -> RwLockWriteGuard<'_, T> {
self.state.write().await
}
}

View File

@@ -15,7 +15,7 @@ use google_home::device;
use google_home::errors::ErrorCode;
use google_home::traits::OnOff;
use google_home::types::Type;
use rumqttc::{matches, Publish};
use rumqttc::{Publish, matches};
use serde::{Deserialize, Serialize};
use serde_json::json;
use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
@@ -95,11 +95,11 @@ pub type OutletOnOff = Outlet<StateOnOff>;
pub type OutletPower = Outlet<StatePower>;
impl<T: OutletState> Outlet<T> {
async fn state(&self) -> RwLockReadGuard<T> {
async fn state(&self) -> RwLockReadGuard<'_, T> {
self.state.read().await
}
async fn state_mut(&self) -> RwLockWriteGuard<T> {
async fn state_mut(&self) -> RwLockWriteGuard<'_, T> {
self.state.write().await
}
}