lint: Cargo fmt

This commit is contained in:
Leon Camus 2023-03-07 23:40:20 +01:00
parent 468c4266c8
commit b62e3e1d47
2 changed files with 13 additions and 22 deletions

View File

@ -307,32 +307,26 @@ impl<D: Driver + 'static> Stack<D> {
#[cfg(feature = "igmp")] #[cfg(feature = "igmp")]
impl<D: Driver + smoltcp::phy::Device + 'static> Stack<D> { impl<D: Driver + smoltcp::phy::Device + 'static> Stack<D> {
pub(crate) fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> pub(crate) fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError>
where where
T: Into<IpAddress> T: Into<IpAddress>,
{ {
let addr = addr.into(); let addr = addr.into();
self.with_mut(|s, i| { self.with_mut(|s, i| {
s.iface.join_multicast_group( s.iface
&mut i.device, .join_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now()))
addr,
instant_to_smoltcp(Instant::now()),
)
}) })
} }
pub(crate) fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> pub(crate) fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError>
where where
T: Into<IpAddress> T: Into<IpAddress>,
{ {
let addr = addr.into(); let addr = addr.into();
self.with_mut(|s, i| { self.with_mut(|s, i| {
s.iface.leave_multicast_group( s.iface
&mut i.device, .leave_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now()))
addr,
instant_to_smoltcp(Instant::now()),
)
}) })
} }

View File

@ -50,10 +50,7 @@ impl<'a, D: Driver> UdpSocket<'a, D> {
udp::PacketBuffer::new(tx_meta, tx_buffer), udp::PacketBuffer::new(tx_meta, tx_buffer),
)); ));
Self { Self { stack, handle }
stack,
handle,
}
} }
pub fn bind<T>(&mut self, endpoint: T) -> Result<(), BindError> pub fn bind<T>(&mut self, endpoint: T) -> Result<(), BindError>
@ -146,15 +143,15 @@ impl<'a, D: Driver> UdpSocket<'a, D> {
#[cfg(feature = "igmp")] #[cfg(feature = "igmp")]
impl<'a, D: Driver + smoltcp::phy::Device + 'static> UdpSocket<'a, D> { impl<'a, D: Driver + smoltcp::phy::Device + 'static> UdpSocket<'a, D> {
pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError>
where where
T: Into<IpAddress> T: Into<IpAddress>,
{ {
self.stack.join_multicast_group(addr) self.stack.join_multicast_group(addr)
} }
pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError> pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, smoltcp::iface::MulticastError>
where where
T: Into<IpAddress> T: Into<IpAddress>,
{ {
self.stack.leave_multicast_group(addr) self.stack.leave_multicast_group(addr)
} }