Relocate cfg attrs out of parse_ip_impl and parse_socket_impl

This commit is contained in:
David Tolnay 2024-09-06 11:03:41 -07:00
parent 07e614b52b
commit 26fb134165
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -1583,6 +1583,7 @@ map_impl! {
////////////////////////////////////////////////////////////////////////////////
#[cfg(any(feature = "std", not(no_core_net)))]
macro_rules! parse_ip_impl {
(
$(#[$attr:meta])*
@ -1735,16 +1736,17 @@ impl<'de> Deserialize<'de> for net::IpAddr {
}
}
#[cfg(any(feature = "std", not(no_core_net)))]
parse_ip_impl! {
#[cfg(any(feature = "std", not(no_core_net)))]
net::Ipv4Addr, "IPv4 address", 4
}
#[cfg(any(feature = "std", not(no_core_net)))]
parse_ip_impl! {
#[cfg(any(feature = "std", not(no_core_net)))]
net::Ipv6Addr, "IPv6 address", 16
}
#[cfg(any(feature = "std", not(no_core_net)))]
macro_rules! parse_socket_impl {
(
$(#[$attr:meta])*
@ -1786,14 +1788,14 @@ impl<'de> Deserialize<'de> for net::SocketAddr {
}
}
#[cfg(any(feature = "std", not(no_core_net)))]
parse_socket_impl! {
#[cfg(any(feature = "std", not(no_core_net)))]
net::SocketAddrV4, "IPv4 socket address",
|(ip, port)| net::SocketAddrV4::new(ip, port),
}
#[cfg(any(feature = "std", not(no_core_net)))]
parse_socket_impl! {
#[cfg(any(feature = "std", not(no_core_net)))]
net::SocketAddrV6, "IPv6 socket address",
|(ip, port)| net::SocketAddrV6::new(ip, port, 0, 0),
}