Skip to content

Commit 81ac54b

Browse files
committed
Resolve redundant_closure_call clippy lint
error: try not to call a closure in the expression where it is declared --> serde/src/de/impls.rs:1590:76 | 1590 | <(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port)) | ^^^^^^^^^^^^^^ ... 1620 | / parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |ip, port| net::SocketAddrV6::new( 1621 | | ip, port, 0, 0 1622 | | )); | |__- in this macro invocation | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call = note: `-D clippy::redundant-closure-call` implied by `-D clippy::all` = note: this error originates in the macro `parse_socket_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
1 parent 6b4e755 commit 81ac54b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

serde/src/de/impls.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ macro_rules! parse_socket_impl {
15871587
if deserializer.is_human_readable() {
15881588
deserializer.deserialize_str(FromStrVisitor::new($expecting))
15891589
} else {
1590-
<(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port))
1590+
<(_, u16)>::deserialize(deserializer).map($new)
15911591
}
15921592
}
15931593
}
@@ -1614,12 +1614,10 @@ impl<'de> Deserialize<'de> for net::SocketAddr {
16141614
}
16151615

16161616
#[cfg(feature = "std")]
1617-
parse_socket_impl!("IPv4 socket address" net::SocketAddrV4, net::SocketAddrV4::new);
1617+
parse_socket_impl!("IPv4 socket address" net::SocketAddrV4, |(ip, port)| net::SocketAddrV4::new(ip, port));
16181618

16191619
#[cfg(feature = "std")]
1620-
parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |ip, port| net::SocketAddrV6::new(
1621-
ip, port, 0, 0
1622-
));
1620+
parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |(ip, port)| net::SocketAddrV6::new(ip, port, 0, 0));
16231621

16241622
////////////////////////////////////////////////////////////////////////////////
16251623

0 commit comments

Comments
 (0)