@@ -40,7 +40,6 @@ use core::convert::TryInto;
4040use core:: fmt;
4141use core:: fmt:: Debug ;
4242use core:: str:: FromStr ;
43- use std:: net:: { AddrParseError , Ipv4Addr , Ipv6Addr , SocketAddr } ;
4443use crate :: io:: { self , Read } ;
4544use crate :: io_extras:: read_to_end;
4645
@@ -651,19 +650,20 @@ impl Readable for NetAddress {
651650 }
652651}
653652
653+ #[ cfg( feature = "std" ) ]
654654impl FromStr for NetAddress {
655- type Err = AddrParseError ;
655+ type Err = std :: net :: AddrParseError ;
656656
657657 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
658- match SocketAddr :: from_str ( s) {
658+ match std :: net :: SocketAddr :: from_str ( s) {
659659 Ok ( addr) => {
660660 let port: u16 = addr. port ( ) ;
661661 match addr {
662- SocketAddr :: V4 ( addr) => {
662+ std :: net :: SocketAddr :: V4 ( addr) => {
663663 let addr = addr. ip ( ) . octets ( ) ;
664664 return Ok ( NetAddress :: IPv4 { addr, port } ) ;
665665 } ,
666- SocketAddr :: V6 ( addr) => {
666+ std :: net :: SocketAddr :: V6 ( addr) => {
667667 let addr = addr. ip ( ) . octets ( ) ;
668668 return Ok ( NetAddress :: IPv6 { addr, port } ) ;
669669 } ,
@@ -2100,7 +2100,7 @@ impl_writeable_msg!(GossipTimestampFilter, {
21002100 timestamp_range,
21012101} , { } ) ;
21022102
2103- #[ cfg( test) ]
2103+ #[ cfg( all ( test, not ( feature = "no-std" ) ) ) ]
21042104mod tests {
21052105 use hex;
21062106 use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
0 commit comments