Skip to content

Commit 685cfc3

Browse files
committed
Optimize port_forwarding::impl_from_addr! impl
Signed-off-by: Jiahao XU <[email protected]>
1 parent f47dd7b commit 685cfc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/port_forwarding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl From<SocketAddr> for Socket<'static> {
5656
macro_rules! impl_from_addr {
5757
($ip:ty) => {
5858
impl From<($ip, u16)> for Socket<'static> {
59-
fn from(addr: ($ip, u16)) -> Self {
60-
Socket::new(&addr).unwrap()
59+
fn from((ip, port): ($ip, u16)) -> Self {
60+
SocketAddr::new(ip.into(), port).into()
6161
}
6262
}
6363
};

0 commit comments

Comments
 (0)