diff options
Diffstat (limited to 'examples/udp-codec.rs')
-rw-r--r-- | examples/udp-codec.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/udp-codec.rs b/examples/udp-codec.rs index 0c9dbf76..6b3f84a0 100644 --- a/examples/udp-codec.rs +++ b/examples/udp-codec.rs @@ -22,7 +22,9 @@ use std::time::Duration; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { - let addr = env::args().nth(1).unwrap_or("127.0.0.1:0".to_string()); + let addr = env::args() + .nth(1) + .unwrap_or_else(|| "127.0.0.1:0".to_string()); // Bind both our sockets and then figure out what ports we got. let a = UdpSocket::bind(&addr).await?; |