From d9e9fd8f9f3cc225533188f4b8f5d9f8d3940616 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Fri, 1 Mar 2024 12:19:41 +0100 Subject: [PATCH] Fix compilation (#103) --- Cargo.toml | 1 - src/bin/hms-mqtt-publish/rumqttc_wrapper.rs | 16 +++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d059ad4a..edaeaa3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,6 @@ edition = "2021" [dependencies] anyhow = "1.0.79" -chrono = "0.4.34" env_logger = "0.11.2" hms2mqtt = { path = "hms2mqtt" } log = "0.4.20" diff --git a/src/bin/hms-mqtt-publish/rumqttc_wrapper.rs b/src/bin/hms-mqtt-publish/rumqttc_wrapper.rs index 234448b6..b9e55d64 100644 --- a/src/bin/hms-mqtt-publish/rumqttc_wrapper.rs +++ b/src/bin/hms-mqtt-publish/rumqttc_wrapper.rs @@ -79,16 +79,14 @@ impl mqtt_wrapper::MqttWrapper for RumqttcWrapper { if use_tls { // Use rustls-native-certs to load root certificates from the operating system. let mut roots = tokio_rustls::rustls::RootCertStore::empty(); - for cert in - rustls_native_certs::load_native_certs().expect("could not load platform certs") - { - roots - .add(&tokio_rustls::rustls::Certificate(cert.to_vec())) - .unwrap(); - } + rustls_native_certs::load_native_certs() + .expect("could not load platform certs") + .into_iter() + .for_each(|cert| { + roots.add(cert).unwrap(); + }); let client_config = ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(roots) .with_no_client_auth(); @@ -105,7 +103,7 @@ impl mqtt_wrapper::MqttWrapper for RumqttcWrapper { mqttoptions.set_credentials(username, password); } - let (mut client, mut connection) = Client::new(mqttoptions, 512); + let (client, mut connection) = Client::new(mqttoptions, 512); thread::spawn(move || { // keep polling the event loop to make sure outgoing messages get sent