Skip to content

Commit 5b55eb9

Browse files
committed
fixed issues & indentations
1 parent e507557 commit 5b55eb9

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

lightning/src/ln/msgs.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ use core::fmt::Debug;
4646
use core::ops::Deref;
4747
#[cfg(feature = "std")]
4848
use core::str::FromStr;
49+
#[cfg(feature = "std")]
4950
use std::net::SocketAddr;
5051
use crate::io::{self, Cursor, Read};
5152
use crate::io_extras::read_to_end;
@@ -976,8 +977,7 @@ impl std::net::ToSocketAddrs for SocketAddress {
976977
Ok(vec![socket_addr].into_iter())
977978
}
978979
SocketAddress::Hostname { ref hostname, port } => {
979-
let socket_addr: Vec<SocketAddr> = (hostname.as_str(), *port).to_socket_addrs()?.collect();
980-
Ok(socket_addr.into_iter())
980+
(hostname.as_str(), *port).to_socket_addrs()
981981
}
982982
SocketAddress::OnionV2(..) => {
983983
Err(std::io::Error::new(std::io::ErrorKind::Other, "Resolution of these \
@@ -4143,22 +4143,17 @@ mod tests {
41434143
#[cfg(feature = "std")]
41444144
fn test_socket_address_to_socket_addrs() {
41454145
assert_eq!(SocketAddress::TcpIpV4 {addr:[0u8; 4], port: 1337,}.to_socket_addrs().unwrap().next().unwrap(),
4146-
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0,0,0,0),
4147-
1337)));
4146+
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0,0,0,0), 1337)));
41484147
assert_eq!(SocketAddress::TcpIpV6 {addr:[0u8; 16], port: 1337,}.to_socket_addrs().unwrap().next().unwrap(),
4149-
SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::from([0u8; 16]),
4150-
1337, 0, 0)));
4151-
assert_eq!(SocketAddress::Hostname { hostname: Hostname::try_from("0.0.0.0".to_string()).unwrap(), port: 0
4152-
}.to_socket_addrs().unwrap().next().unwrap(),
4153-
SocketAddr::V4(SocketAddrV4::new(
4154-
Ipv4Addr::from([0u8; 4]),0)));
4148+
SocketAddr::V6(SocketAddrV6::new(Ipv6Addr::from([0u8; 16]), 1337, 0, 0)));
4149+
assert_eq!(SocketAddress::Hostname { hostname: Hostname::try_from("0.0.0.0".to_string()).unwrap(), port: 0 }
4150+
.to_socket_addrs().unwrap().next().unwrap(), SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::from([0u8; 4]),0)));
41554151
assert!(SocketAddress::OnionV2([0u8; 12]).to_socket_addrs().is_err());
4156-
assert!(SocketAddress::OnionV3{
4157-
ed25519_pubkey: [37, 24, 75, 5, 25, 73, 117, 194, 139, 102, 182, 107, 4, 105, 247, 246, 85,
4158-
111, 177, 172, 49, 137, 167, 155, 64, 221, 163, 47, 31, 33, 71, 3],
4152+
assert!(SocketAddress::OnionV3{ ed25519_pubkey: [37, 24, 75, 5, 25, 73, 117, 194, 139, 102,
4153+
182, 107, 4, 105, 247, 246, 85, 111, 177, 172, 49, 137, 167, 155, 64, 221, 163, 47, 31,
4154+
33, 71, 3],
41594155
checksum: 48326,
41604156
version: 121,
4161-
port: 1234
4162-
}.to_socket_addrs().is_err());
4157+
port: 1234 }.to_socket_addrs().is_err());
41634158
}
41644159
}

0 commit comments

Comments
 (0)