adding proof to a panicker

This commit is contained in:
Tomasz Drwięga 2016-11-29 17:14:28 +01:00
parent f5a899606e
commit df3c07b0a9

View File

@ -266,7 +266,11 @@ impl Server {
#[cfg(test)] #[cfg(test)]
/// Returns address that this server is bound to. /// Returns address that this server is bound to.
pub fn addr(&self) -> &SocketAddr { pub fn addr(&self) -> &SocketAddr {
&self.server.as_ref().expect("server is always Some at the start; it's consumed only when object is dropped; qed").addrs()[0] self.server.as_ref()
.expect("server is always Some at the start; it's consumed only when object is dropped; qed")
.addrs()
.first()
.expect("You cannot start the server without binding to at least one address; qed")
} }
} }