From 6bf4717b0a17cf4ca3439f0b2726b7fb6f5f3b13 Mon Sep 17 00:00:00 2001 From: bjoernQ Date: Tue, 18 Jul 2023 10:57:05 +0200 Subject: [PATCH] cfg-gate `unapply_config_v4` --- embassy-net/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/embassy-net/src/lib.rs b/embassy-net/src/lib.rs index f43e3797b..ae595d0d6 100644 --- a/embassy-net/src/lib.rs +++ b/embassy-net/src/lib.rs @@ -648,16 +648,17 @@ impl Inner { socket.set_retry_config(config.retry_config); } - #[allow(unused)] // used only with dhcp + #[cfg(feature = "dhcpv4")] fn unapply_config_v4(&mut self, s: &mut SocketStack) { #[cfg(feature = "medium-ethernet")] let medium = self.device.capabilities().medium; debug!("Lost IP configuration"); s.iface.update_ip_addrs(|ip_addrs| { + #[cfg(feature = "proto-ipv4")] if let Some((index, _)) = ip_addrs .iter() .enumerate() - .find(|(index, &addr)| matches!(addr, IpCidr::Ipv4(_))) + .find(|(_, &addr)| matches!(addr, IpCidr::Ipv4(_))) { ip_addrs.remove(index); }