diff --git a/tests/common/port.rs b/tests/common/port.rs index 5de7c4f..c9129a6 100644 --- a/tests/common/port.rs +++ b/tests/common/port.rs @@ -16,8 +16,8 @@ use std::net::TcpListener; /// process can be handed the same number. /// /// Transfer it with [`PortReservation::into_std_listener`] to start a service -/// without releasing its address. Dropping it or calling `release` relinquishes -/// the address and must not be used before starting a replacement service. +/// without releasing its address. Dropping it relinquishes the address, so a +/// reservation must be transferred, not dropped, to start a service on it. #[derive(Debug)] pub struct PortReservation { port: u16, @@ -59,14 +59,6 @@ impl PortReservation { _listener: listener, } } - - /// Relinquish the address. A later bind to this port is inherently racy. - pub fn release(self) -> u16 { - let port = self.port; - // `self` is consumed; the listener inside is dropped here. - drop(self); - port - } } /// Bind `127.0.0.1:0`, capture the assigned port, and **keep the listener