From d0b9c08c3a51caf0c83b887badb967d1298b641d Mon Sep 17 00:00:00 2001 From: JSanten Date: Mon, 10 Nov 2025 19:07:13 +0100 Subject: [PATCH] updating the method used &_[..] to _.to_str() method introduced in Rust version 1.7.0 --- listings/ch21-web-server/listing-21-10/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch21-web-server/listing-21-10/src/main.rs b/listings/ch21-web-server/listing-21-10/src/main.rs index 81b36562af..ea6dbb3b5d 100644 --- a/listings/ch21-web-server/listing-21-10/src/main.rs +++ b/listings/ch21-web-server/listing-21-10/src/main.rs @@ -28,7 +28,7 @@ fn handle_connection(mut stream: TcpStream) { let request_line = buf_reader.lines().next().unwrap().unwrap(); // ANCHOR: here - let (status_line, filename) = match &request_line[..] { + let (status_line, filename) = match request_line.as_str() { "GET / HTTP/1.1" => ("HTTP/1.1 200 OK", "hello.html"), "GET /sleep HTTP/1.1" => { thread::sleep(Duration::from_secs(5));