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

49
Cargo.lock generated
View File

@@ -782,7 +782,7 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.6.0",
"socket2",
"tokio",
"tower-service",
"tracing",
@@ -1371,9 +1371,9 @@ dependencies = [
[[package]]
name = "quinn"
version = "0.11.8"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "626214629cda6781b6dc1d316ba307189c85ba657213ce642d9c77670f8202c8"
checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
dependencies = [
"bytes",
"cfg_aliases",
@@ -1382,7 +1382,7 @@ dependencies = [
"quinn-udp",
"rustc-hash",
"rustls 0.23.31",
"socket2 0.5.10",
"socket2",
"thiserror 2.0.16",
"tokio",
"tracing",
@@ -1391,9 +1391,9 @@ dependencies = [
[[package]]
name = "quinn-proto"
version = "0.11.12"
version = "0.11.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49df843a9161c85bb8aae55f101bc0bac8bcafd637a620d9122fd7e0b2f7422e"
checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31"
dependencies = [
"bytes",
"getrandom 0.3.3",
@@ -1412,16 +1412,16 @@ dependencies = [
[[package]]
name = "quinn-udp"
version = "0.5.13"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcebb1209ee276352ef14ff8732e24cc2b02bbac986cd74a4c81bcb2f9881970"
checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.5.10",
"socket2",
"tracing",
"windows-sys 0.59.0",
"windows-sys 0.60.2",
]
[[package]]
@@ -1479,9 +1479,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.11.1"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
dependencies = [
"aho-corasick",
"memchr",
@@ -1491,9 +1491,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.9"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
dependencies = [
"aho-corasick",
"memchr",
@@ -1502,9 +1502,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.5"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
[[package]]
name = "reqwest"
@@ -1835,16 +1835,6 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "socket2"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "socket2"
version = "0.6.0"
@@ -2005,7 +1995,7 @@ dependencies = [
"mio",
"pin-project-lite",
"slab",
"socket2 0.6.0",
"socket2",
"tokio-macros",
"windows-sys 0.59.0",
]
@@ -2193,13 +2183,14 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.6"
version = "2.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "137a3c834eaf7139b73688502f3f1141a0337c5d8e4d9b536f9b8c796e26a7c4"
checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
"serde",
]
[[package]]

View File

@@ -1,7 +1,7 @@
[package]
name = "automation"
version = "0.1.0"
edition = "2021"
edition = "2024"
[workspace]
members = [

View File

@@ -1,4 +1,4 @@
FROM rust:1.86 AS base
FROM rust:1.89 AS base
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN cargo install cargo-chef --locked --version 0.1.71 && \
cargo install cargo-auditable --locked --version 0.6.6

View File

@@ -1,7 +1,7 @@
[package]
name = "automation_cast"
version = "0.1.0"
edition = "2021"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,7 +1,7 @@
[package]
name = "automation_devices"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
automation_lib = { workspace = true }
@@ -17,7 +17,7 @@ tracing = { workspace = true }
serde_json = { workspace = true }
impls = { workspace = true }
serde = { workspace = true }
reqwest = { workspace = true } # Use rustls, since the other packages also use rustls
reqwest = { workspace = true } # Use rustls, since the other packages also use rustls
anyhow = { workspace = true }
axum = { workspace = true }
bytes = { workspace = true }

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
}
}

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
}
}

View File

@@ -1,7 +1,7 @@
[package]
name = "automation_macro"
version = "0.1.0"
edition = "2021"
edition = "2024"
[lib]
proc-macro = true

View File

@@ -1,9 +1,8 @@
#![feature(let_chains)]
#![feature(iter_intersperse)]
mod lua_device_config;
use lua_device_config::impl_lua_device_config_macro;
use syn::{parse_macro_input, DeriveInput};
use syn::{DeriveInput, parse_macro_input};
#[proc_macro_derive(LuaDeviceConfig, attributes(device_config))]
pub fn lua_device_config_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {

View File

@@ -6,8 +6,8 @@ use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::token::Paren;
use syn::{
parenthesized, Data, DataStruct, DeriveInput, Expr, Field, Fields, FieldsNamed, LitStr, Result,
Token, Type,
Data, DataStruct, DeriveInput, Expr, Field, Fields, FieldsNamed, LitStr, Result, Token, Type,
parenthesized,
};
mod kw {
@@ -155,7 +155,7 @@ fn field_from_lua(field: &Field) -> TokenStream {
[] => field.ident.clone().unwrap().to_string(),
[rename] => rename.to_owned(),
_ => {
return quote_spanned! {field.span() => compile_error!("Field contains duplicate 'rename'")}
return quote_spanned! {field.span() => compile_error!("Field contains duplicate 'rename'")};
}
};
@@ -174,7 +174,7 @@ fn field_from_lua(field: &Field) -> TokenStream {
[] => quote! {panic!(#missing)},
[default] => default.to_owned(),
_ => {
return quote_spanned! {field.span() => compile_error!("Field contains duplicate 'default'")}
return quote_spanned! {field.span() => compile_error!("Field contains duplicate 'default'")};
}
};
@@ -232,7 +232,7 @@ fn field_from_lua(field: &Field) -> TokenStream {
[] => value,
[value] => value.to_owned(),
_ => {
return quote_spanned! {field.span() => compile_error!("Only one of either 'from' or 'with' is allowed")}
return quote_spanned! {field.span() => compile_error!("Only one of either 'from' or 'with' is allowed")};
}
};

View File

@@ -1,7 +1,7 @@
[package]
name = "google_home"
version = "0.1.0"
edition = "2021"
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -2,14 +2,14 @@ use std::collections::HashMap;
use std::sync::Arc;
use automation_cast::Cast;
use futures::future::{join_all, OptionFuture};
use futures::future::{OptionFuture, join_all};
use thiserror::Error;
use tokio::sync::Mutex;
use crate::Device;
use crate::errors::{DeviceError, ErrorCode};
use crate::request::{self, Intent, Request};
use crate::response::{self, execute, query, sync, Response, ResponsePayload};
use crate::Device;
use crate::response::{self, Response, ResponsePayload, execute, query, sync};
#[derive(Debug)]
pub struct GoogleHome {
@@ -64,7 +64,7 @@ impl GoogleHome {
devices: &HashMap<String, Box<T>>,
) -> sync::Payload {
let mut resp_payload = sync::Payload::new(&self.user_id);
let f = devices.iter().map(|(_, device)| async move {
let f = devices.values().map(|device| async move {
if let Some(device) = device.as_ref().cast() {
Some(Device::sync(device).await)
} else {

View File

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

View File

@@ -3,8 +3,8 @@ use automation_cast::Cast;
use google_home_macro::traits;
use serde::{Deserialize, Serialize};
use crate::errors::ErrorCode;
use crate::Device;
use crate::errors::ErrorCode;
traits! {
Device,

View File

@@ -1,7 +1,7 @@
[package]
name = "google_home_macro"
version = "0.1.0"
edition = "2021"
edition = "2024"
[lib]
proc-macro = true

View File

@@ -1,4 +1,3 @@
#![feature(let_chains)]
#![feature(iter_intersperse)]
use proc_macro::TokenStream;
use quote::quote;
@@ -6,8 +5,8 @@ use syn::parse::Parse;
use syn::punctuated::Punctuated;
use syn::token::Brace;
use syn::{
braced, parse_macro_input, GenericArgument, Ident, LitStr, Path, PathArguments, PathSegment,
ReturnType, Signature, Token, Type, TypePath,
GenericArgument, Ident, LitStr, Path, PathArguments, PathSegment, ReturnType, Signature, Token,
Type, TypePath, braced, parse_macro_input,
};
mod kw {

View File

@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-12-06"
channel = "nightly-2025-08-20"
components = ["rustfmt", "clippy", "rust-analyzer"]
profile = "minimal"

View File

@@ -2,9 +2,9 @@ use std::result;
use axum::async_trait;
use axum::extract::{FromRef, FromRequestParts};
use axum::http::StatusCode;
use axum::http::request::Parts;
use axum::http::status::InvalidStatusCode;
use axum::http::StatusCode;
use axum::response::IntoResponse;
use serde::{Deserialize, Serialize};
use thiserror::Error;