Skip to content

Commit 9cc89b5

Browse files
samueltardieutaiki-e
authored andcommitted
Use more modern interpolation
1 parent 1881bef commit 9cc89b5

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/03_01_async_await/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ async fn blocks() {
6262

6363
let future_one = async {
6464
// ...
65-
println!("{}", my_string);
65+
println!("{my_string}");
6666
};
6767

6868
let future_two = async {
6969
// ...
70-
println!("{}", my_string);
70+
println!("{my_string}");
7171
};
7272

7373
// Run both futures to completion, printing "foo" twice:
@@ -84,7 +84,7 @@ fn move_block() -> impl Future<Output = ()> {
8484
let my_string = "foo".to_string();
8585
async move {
8686
// ...
87-
println!("{}", my_string);
87+
println!("{my_string}");
8888
}
8989
}
9090
// ANCHOR_END: async_move_examples

examples/09_01_sync_tcp_server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn handle_connection(mut stream: TcpStream) {
3333

3434
// Write response back to the stream,
3535
// and flush the stream to ensure the response is sent back to the client
36-
let response = format!("{}{}", status_line, contents);
36+
let response = format!("{status_line}{contents}");
3737
stream.write(response.as_bytes()).unwrap();
3838
stream.flush().unwrap();
3939
}

examples/09_03_slow_request/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async fn handle_connection(mut stream: TcpStream) {
3333
};
3434
let contents = fs::read_to_string(filename).unwrap();
3535

36-
let response = format!("{}{}", status_line, contents);
36+
let response = format!("{status_line}{contents}");
3737
stream.write(response.as_bytes()).unwrap();
3838
stream.flush().unwrap();
3939
}

examples/09_05_final_tcp_server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async fn handle_connection(mut stream: impl Read + Write + Unpin) {
3333
("HTTP/1.1 404 NOT FOUND\r\n\r\n", "404.html")
3434
};
3535
let contents = fs::read_to_string(filename).unwrap();
36-
let response = format!("{}{}", status_line, contents);
36+
let response = format!("{status_line}{contents}");
3737
stream.write(response.as_bytes()).await.unwrap();
3838
stream.flush().await.unwrap();
3939
}

0 commit comments

Comments
 (0)