diff --git a/src/hardware/setup.rs b/src/hardware/setup.rs index f647047..a2ee8fa 100644 --- a/src/hardware/setup.rs +++ b/src/hardware/setup.rs @@ -82,8 +82,8 @@ impl TcpSocketStorage { } } -impl NetStorage { - pub fn new() -> Self { +impl Default for NetStorage { + fn default() -> Self { NetStorage { // Placeholder for the real IP address, which is initialized at runtime. ip_addrs: [smoltcp::wire::IpCidr::Ipv6( @@ -671,7 +671,7 @@ pub fn setup( // Note(unwrap): The hardware configuration function is only allowed to be called once. // Unwrapping is intended to panic if called again to prevent re-use of global memory. let store = - cortex_m::singleton!(: NetStorage = NetStorage::new()).unwrap(); + cortex_m::singleton!(: NetStorage = NetStorage::default()).unwrap(); store.ip_addrs[0] = smoltcp::wire::IpCidr::new( smoltcp::wire::IpAddress::Ipv4( diff --git a/src/net/network_processor.rs b/src/net/network_processor.rs index eeb4f06..8d7de25 100644 --- a/src/net/network_processor.rs +++ b/src/net/network_processor.rs @@ -74,12 +74,10 @@ impl NetworkProcessor { // Service the network stack to process any inbound and outbound traffic. let now = self.clock.current_ms(); - let result = match self.stack.lock(|stack| stack.poll(now)) { + match self.stack.lock(|stack| stack.poll(now)) { Ok(true) => UpdateState::Updated, Ok(false) => UpdateState::NoChange, Err(_) => UpdateState::Updated, - }; - - result + } } }