1- use crate :: process:: ProcessInfo ;
21use crate :: Column ;
2+ use crate :: process:: ProcessInfo ;
33#[ cfg( target_os = "macos" ) ]
44use libproc:: libproc:: net_info:: TcpSIState ;
55#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -14,7 +14,7 @@ use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
1414use windows_sys:: Win32 :: Foundation :: { ERROR_INSUFFICIENT_BUFFER , NO_ERROR } ;
1515#[ cfg( target_os = "windows" ) ]
1616use windows_sys:: Win32 :: NetworkManagement :: IpHelper :: {
17- GetTcp6Table2 , GetTcpTable2 , MIB_TCP6TABLE2 , MIB_TCPTABLE2 , MIB_TCP_STATE , MIB_TCP_STATE_LISTEN ,
17+ GetTcp6Table2 , GetTcpTable2 , MIB_TCP_STATE , MIB_TCP_STATE_LISTEN , MIB_TCP6TABLE2 , MIB_TCPTABLE2 ,
1818} ;
1919#[ cfg( target_os = "windows" ) ]
2020use windows_sys:: Win32 :: Networking :: WinSock :: { ntohl, ntohs} ;
@@ -68,10 +68,10 @@ impl Column for TcpPort {
6868 for sock in & socks {
6969 let mut tcp_iter = self . tcp_entry . iter ( ) . chain ( self . tcp6_entry . iter ( ) ) ;
7070 let entry = tcp_iter. find ( |& x| x. inode == * sock) ;
71- if let Some ( entry) = entry {
72- if entry. state == TcpState :: Listen {
73- ports . push ( entry . local_address . port ( ) ) ;
74- }
71+ if let Some ( entry) = entry
72+ && entry. state == TcpState :: Listen
73+ {
74+ ports . push ( entry . local_address . port ( ) ) ;
7575 }
7676 }
7777 ports. sort_unstable ( ) ;
0 commit comments