From f0ae7ef308d0de77c5b72229bbd8f1400a97b180 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 5 Aug 2024 14:54:10 +0200 Subject: [PATCH 1/2] silence new rust 1.80 warnings A new lint check was added[1] that makes sure all cfg values are checked. As such we must tell the compiler which values are valid so it doesn't flag them as unexpected. [1] https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html#cargorustc-check-cfg-for-buildrsbuild-script Signed-off-by: Paul Holzinger --- build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build.rs b/build.rs index 4dd01e5c..bcc9c64a 100644 --- a/build.rs +++ b/build.rs @@ -75,6 +75,7 @@ fn main() { "none" => "none", inv => panic!("Invalid default firewall driver {}", inv), }; + println!("cargo:rustc-check-cfg=cfg(default_fw, values(\"nftables\", \"iptables\", \"none\"))"); println!("cargo:rustc-cfg=default_fw=\"{}\"", fwdriver); println!("cargo:rustc-env=DEFAULT_FW={fwdriver}"); } From 06d8a9e47b6c5840ef87d24e3e27dcd3a3210dba Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 5 Aug 2024 15:52:44 +0200 Subject: [PATCH 2/2] fix new rust 1.80 lint issues Signed-off-by: Paul Holzinger --- src/dhcp_proxy/cache.rs | 2 +- src/dhcp_proxy/lib.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/dhcp_proxy/cache.rs b/src/dhcp_proxy/cache.rs index da895769..0ad98307 100644 --- a/src/dhcp_proxy/cache.rs +++ b/src/dhcp_proxy/cache.rs @@ -43,7 +43,7 @@ impl LeaseCache { /// # Arguments /// /// * `writer`: any type that can has the Write and Clear trait implemented. In production this - /// is a file. In development/testing this is a Cursor of bytes + /// is a file. In development/testing this is a Cursor of bytes /// /// returns: Result, Error> /// diff --git a/src/dhcp_proxy/lib.rs b/src/dhcp_proxy/lib.rs index 848b76b0..cb35bc02 100644 --- a/src/dhcp_proxy/lib.rs +++ b/src/dhcp_proxy/lib.rs @@ -40,10 +40,7 @@ pub mod g_rpc { impl From for Lease { fn from(l: DhcpV4Lease) -> Lease { // Since these fields are optional as per mozim. Match them first and then set them - let domain_name = match l.domain_name { - None => String::from(""), - Some(l) => l, - }; + let domain_name = l.domain_name.unwrap_or_default(); let mtu = l.mtu.unwrap_or(0) as u32; Lease {