@@ -40,7 +40,6 @@ use core::convert::TryInto;
40
40
use core:: fmt;
41
41
use core:: fmt:: Debug ;
42
42
use core:: str:: FromStr ;
43
- use std:: net:: { AddrParseError , Ipv4Addr , Ipv6Addr , SocketAddr } ;
44
43
use crate :: io:: { self , Read } ;
45
44
use crate :: io_extras:: read_to_end;
46
45
@@ -651,19 +650,20 @@ impl Readable for NetAddress {
651
650
}
652
651
}
653
652
653
+ #[ cfg( feature = "std" ) ]
654
654
impl FromStr for NetAddress {
655
- type Err = AddrParseError ;
655
+ type Err = std :: net :: AddrParseError ;
656
656
657
657
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
658
- match SocketAddr :: from_str ( s) {
658
+ match std :: net :: SocketAddr :: from_str ( s) {
659
659
Ok ( addr) => {
660
660
let port: u16 = addr. port ( ) ;
661
661
match addr {
662
- SocketAddr :: V4 ( addr) => {
662
+ std :: net :: SocketAddr :: V4 ( addr) => {
663
663
let addr = addr. ip ( ) . octets ( ) ;
664
664
return Ok ( NetAddress :: IPv4 { addr, port } ) ;
665
665
} ,
666
- SocketAddr :: V6 ( addr) => {
666
+ std :: net :: SocketAddr :: V6 ( addr) => {
667
667
let addr = addr. ip ( ) . octets ( ) ;
668
668
return Ok ( NetAddress :: IPv6 { addr, port } ) ;
669
669
} ,
@@ -2100,7 +2100,7 @@ impl_writeable_msg!(GossipTimestampFilter, {
2100
2100
timestamp_range,
2101
2101
} , { } ) ;
2102
2102
2103
- #[ cfg( test) ]
2103
+ #[ cfg( all ( test, not ( feature = "no-std" ) ) ) ]
2104
2104
mod tests {
2105
2105
use hex;
2106
2106
use crate :: ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
0 commit comments