diff --git a/src/dhcp/clientv4.rs b/src/dhcp/clientv4.rs index 7e344afab..a2d33426e 100644 --- a/src/dhcp/clientv4.rs +++ b/src/dhcp/clientv4.rs @@ -94,7 +94,7 @@ impl Client { /// Instant::now() /// ); /// ``` - pub fn new<'a, 'b>(sockets: &mut SocketSet<'a, 'b>, rx_buffer: RawSocketBuffer<'b>, tx_buffer: RawSocketBuffer<'b>, now: Instant) -> Self + pub fn new<'a>(sockets: &mut SocketSet<'a>, rx_buffer: RawSocketBuffer<'a>, tx_buffer: RawSocketBuffer<'a>, now: Instant) -> Self { let raw_socket = RawSocket::new(IpVersion::Ipv4, IpProtocol::Udp, rx_buffer, tx_buffer); let raw_handle = sockets.add(raw_socket); diff --git a/src/iface/ethernet.rs b/src/iface/ethernet.rs index 4aa2e7e84..c5d76454e 100644 --- a/src/iface/ethernet.rs +++ b/src/iface/ethernet.rs @@ -1731,7 +1731,7 @@ mod test { use super::{EthernetPacket, IpPacket}; fn create_loopback<'a, 'b, 'c>() -> (EthernetInterface<'static, 'b, 'c, Loopback>, - SocketSet<'static, 'a>) { + SocketSet<'a>) { // Create a basic device let device = Loopback::new(); let ip_addrs = [ diff --git a/src/socket/set.rs b/src/socket/set.rs index 883bed86d..826776348 100644 --- a/src/socket/set.rs +++ b/src/socket/set.rs @@ -27,16 +27,16 @@ impl fmt::Display for Handle { /// An extensible set of sockets. /// -/// The lifetime `'b` is used when storing a `Socket<'b>`. +/// The lifetime `'a` is used when storing a `Socket<'a>`. #[derive(Debug)] -pub struct Set<'a, 'b: 'a> { - sockets: ManagedSlice<'a, Option>> +pub struct Set<'a> { + sockets: ManagedSlice<'a, Option>> } -impl<'a, 'b: 'a> Set<'a, 'b> { +impl<'a> Set<'a> { /// Create a socket set using the provided storage. - pub fn new(sockets: SocketsT) -> Set<'a, 'b> - where SocketsT: Into>>> { + pub fn new(sockets: SocketsT) -> Set<'a> + where SocketsT: Into>>> { let sockets = sockets.into(); Set { sockets } } @@ -46,10 +46,10 @@ impl<'a, 'b: 'a> Set<'a, 'b> { /// # Panics /// This function panics if the storage is fixed-size (not a `Vec`) and is full. pub fn add(&mut self, socket: T) -> Handle - where T: Into> + where T: Into> { - fn put<'b>(index: usize, slot: &mut Option>, - mut socket: Socket<'b>) -> Handle { + fn put<'a>(index: usize, slot: &mut Option>, + mut socket: Socket<'a>) -> Handle { net_trace!("[{}]: adding", index); let handle = Handle(index); socket.meta_mut().handle = handle; @@ -83,7 +83,7 @@ impl<'a, 'b: 'a> Set<'a, 'b> { /// # Panics /// This function may panic if the handle does not belong to this socket set /// or the socket has the wrong type. - pub fn get>(&mut self, handle: Handle) -> SocketRef { + pub fn get>(&mut self, handle: Handle) -> SocketRef { match self.sockets[handle.0].as_mut() { Some(item) => { T::downcast(SocketRef::new(&mut item.socket)) @@ -97,7 +97,7 @@ impl<'a, 'b: 'a> Set<'a, 'b> { /// /// # Panics /// This function may panic if the handle does not belong to this socket set. - pub fn remove(&mut self, handle: Handle) -> Socket<'b> { + pub fn remove(&mut self, handle: Handle) -> Socket<'a> { net_trace!("[{}]: removing", handle.0); match self.sockets[handle.0].take() { Some(item) => item.socket, @@ -165,12 +165,12 @@ impl<'a, 'b: 'a> Set<'a, 'b> { } /// Iterate every socket in this set. - pub fn iter<'d>(&'d self) -> Iter<'d, 'b> { + pub fn iter<'d>(&'d self) -> Iter<'d, 'a> { Iter { lower: self.sockets.iter() } } /// Iterate every socket in this set, as SocketRef. - pub fn iter_mut<'d>(&'d mut self) -> IterMut<'d, 'b> { + pub fn iter_mut<'d>(&'d mut self) -> IterMut<'d, 'a> { IterMut { lower: self.sockets.iter_mut() } } }