summaryrefslogtreecommitdiffstats
path: root/examples/tinyhttp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tinyhttp.rs')
-rw-r--r--examples/tinyhttp.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/tinyhttp.rs b/examples/tinyhttp.rs
index f8731b9f..5ddf0d48 100644
--- a/examples/tinyhttp.rs
+++ b/examples/tinyhttp.rs
@@ -27,7 +27,9 @@ use tokio_util::codec::{Decoder, Encoder, Framed};
async fn main() -> Result<(), Box<dyn Error>> {
// Parse the arguments, bind the TCP socket we'll be listening to, spin up
// our worker threads, and start shipping sockets to those worker threads.
- let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string());
+ let addr = env::args()
+ .nth(1)
+ .unwrap_or_else(|| "127.0.0.1:8080".to_string());
let mut server = TcpListener::bind(&addr).await?;
let mut incoming = server.incoming();
println!("Listening on: {}", addr);