From c43f673fe6c6f09c5f0c80b8e0b41024f610ec55 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 21 Apr 2024 00:42:10 +0000 Subject: [PATCH] [BOT] Updating 7c417e996001ecd0c16821cdc0c00934ff84fa4d content --- rustbook-en/Cargo.lock | 20 +++++----- rustbook-en/Cargo.toml | 2 +- .../listing-02-01/src/main.rs | 2 +- .../listing-04-01/src/main.rs | 2 +- .../listing-04-03/src/main.rs | 4 +- .../listing-04-05/src/main.rs | 2 +- .../src/main.rs | 4 +- .../src/main.rs | 2 +- .../no-listing-05-clone/src/main.rs | 2 +- .../no-listing-06-copy/src/main.rs | 2 +- .../no-listing-07-reference/src/main.rs | 2 +- .../src/main.rs | 2 +- .../src/main.rs | 4 +- .../no-listing-19-slice-error/src/main.rs | 2 +- .../listing-05-12/src/main.rs | 2 +- .../output-only-02-pretty-debug/src/main.rs | 2 +- .../listing-06-06/src/main.rs | 2 +- .../src/main.rs | 2 +- .../no-listing-12-if-let/src/main.rs | 2 +- .../src/main.rs | 2 +- .../src/main.rs | 2 +- .../quick-reference-example/src/main.rs | 2 +- .../listing-08-23/src/main.rs | 2 +- .../listing-08-24/src/main.rs | 2 +- .../listing-08-25/src/main.rs | 2 +- .../listing-09-04/src/main.rs | 2 +- .../listing-09-05/src/main.rs | 4 +- .../listing-10-01/src/main.rs | 2 +- .../listing-10-02/src/main.rs | 4 +- .../listing-10-03/src/main.rs | 4 +- .../listing-10-04/src/main.rs | 4 +- .../listing-10-05/src/main.rs | 4 +- .../listing-10-16/src/main.rs | 2 +- .../listing-10-17/src/main.rs | 2 +- .../listing-10-18/src/main.rs | 2 +- .../listing-10-19/src/main.rs | 2 +- .../listing-10-20/src/main.rs | 2 +- .../listing-10-21/src/main.rs | 2 +- .../listing-10-22/src/main.rs | 2 +- .../listing-10-23/output.txt | 4 +- .../listing-10-23/src/main.rs | 2 +- .../src/main.rs | 2 +- .../src/main.rs | 2 +- .../src/main.rs | 2 +- .../src/main.rs | 4 +- .../listing-11-10/src/lib.rs | 2 +- .../listing-11-13/tests/integration_test.rs | 4 +- .../no-listing-05-greeter/src/lib.rs | 2 +- .../output-only-01-show-output/src/lib.rs | 2 +- .../listing-12-02/src/main.rs | 4 +- .../listing-12-03/src/main.rs | 4 +- .../listing-12-04/src/main.rs | 4 +- .../listing-12-05/src/main.rs | 4 +- .../listing-13-04/src/main.rs | 8 ++-- .../listing-13-05/src/main.rs | 4 +- .../listing-13-06/src/main.rs | 4 +- .../listing-13-07/src/main.rs | 2 +- .../listing-13-08/src/main.rs | 2 +- .../listing-13-09/src/main.rs | 2 +- .../listing-13-11/src/main.rs | 2 +- .../listing-15-01/src/main.rs | 2 +- .../listing-15-24/src/main.rs | 6 +-- .../listing-16-01/src/main.rs | 4 +- .../listing-16-02/src/main.rs | 4 +- .../listing-16-03/output.txt | 6 +-- .../listing-16-03/src/main.rs | 2 +- .../listing-16-04/src/main.rs | 2 +- .../listing-16-05/src/main.rs | 2 +- .../listing-16-08/src/main.rs | 2 +- .../listing-16-09/output.txt | 4 +- .../listing-16-09/src/main.rs | 4 +- .../listing-16-10/src/main.rs | 2 +- .../listing-16-11/src/main.rs | 2 +- .../listing-16-12/src/main.rs | 2 +- .../no-listing-01-join-too-early/src/main.rs | 4 +- .../output-only-01-move-drop/output.txt | 4 +- .../output-only-01-move-drop/src/main.rs | 2 +- .../listing-18-02/src/main.rs | 2 +- .../listing-18-03/src/main.rs | 2 +- .../listing-18-07/src/main.rs | 2 +- .../listing-18-09/src/main.rs | 2 +- .../listing-18-10/src/main.rs | 2 +- .../listing-18-11/src/main.rs | 4 +- .../listing-18-15/src/main.rs | 2 +- .../listing-18-17/src/main.rs | 2 +- .../listing-18-18/src/main.rs | 2 +- .../listing-18-21/src/main.rs | 2 +- .../listing-18-22/src/main.rs | 2 +- .../listing-18-23/src/main.rs | 2 +- .../listing-18-25/src/main.rs | 2 +- .../listing-18-26/src/main.rs | 4 +- .../listing-18-27/src/main.rs | 4 +- .../listing-18-29/src/main.rs | 4 +- .../listing-19-09/src/main.rs | 2 +- .../listing-19-10/src/main.rs | 2 +- .../listing-19-22/src/main.rs | 2 +- .../listing-19-23/src/main.rs | 2 +- .../listing-19-27/src/main.rs | 2 +- .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/Cargo.toml | 2 +- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../src/main.rs | 2 +- .../src/main.rs | 2 +- .../hello_macro/hello_macro_derive/Cargo.lock | 36 ++++++++--------- .../hello_macro/hello_macro_derive/Cargo.toml | 2 +- .../hello_macro/hello_macro_derive/src/lib.rs | 1 - .../pancakes/Cargo.lock | 40 +++++++++---------- .../ch20-web-server/listing-20-02/src/main.rs | 2 +- .../redirects/choosing-your-guarantees.md | 2 +- rustbook-en/redirects/iterators.md | 2 +- rustbook-en/redirects/lifetimes.md | 2 +- rustbook-en/redirects/loops.md | 6 +-- rustbook-en/redirects/mutability.md | 4 +- .../appendix-04-useful-development-tools.md | 3 +- .../src/ch02-00-guessing-game-tutorial.md | 4 +- rustbook-en/src/ch03-05-control-flow.md | 3 ++ rustbook-en/src/ch04-03-slices.md | 6 +-- ...referring-to-an-item-in-the-module-tree.md | 2 +- .../ch09-02-recoverable-errors-with-result.md | 4 +- rustbook-en/src/ch11-01-writing-tests.md | 8 ++-- rustbook-en/src/ch11-03-test-organization.md | 5 ++- ...improving-error-handling-and-modularity.md | 14 +++---- rustbook-en/src/ch13-01-closures.md | 4 +- .../src/ch13-03-improving-our-io-project.md | 2 +- .../src/ch14-02-publishing-to-crates-io.md | 5 ++- rustbook-en/src/ch14-03-cargo-workspaces.md | 11 +++-- rustbook-en/src/ch17-01-what-is-oo.md | 8 ++-- rustbook-en/src/ch18-02-refutability.md | 8 ++-- rustbook-en/src/ch20-01-single-threaded.md | 2 +- rustbook-en/tools/doc-to-md.sh | 2 +- rustbook-en/tools/src/bin/convert_quotes.rs | 6 +-- rustbook-en/tools/src/bin/lfp.rs | 2 +- rustbook-en/tools/src/bin/link2print.rs | 10 ++--- rustbook-en/tools/src/bin/release_listings.rs | 2 +- .../tools/src/bin/remove_hidden_lines.rs | 4 +- rustbook-en/tools/src/bin/remove_links.rs | 4 +- rustbook-en/tools/src/bin/remove_markup.rs | 4 +- 139 files changed, 295 insertions(+), 287 deletions(-) diff --git a/rustbook-en/Cargo.lock b/rustbook-en/Cargo.lock index d0bbf758..5e9f838f 100644 --- a/rustbook-en/Cargo.lock +++ b/rustbook-en/Cargo.lock @@ -101,18 +101,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.18" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -167,18 +167,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.137" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -193,9 +193,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.96" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", diff --git a/rustbook-en/Cargo.toml b/rustbook-en/Cargo.toml index c59425f9..60bd20b0 100644 --- a/rustbook-en/Cargo.toml +++ b/rustbook-en/Cargo.toml @@ -2,7 +2,7 @@ name = "rust-book" version = "0.0.1" description = "The Rust Book" -edition = "2018" +edition = "2021" [[bin]] name = "concat_chapters" diff --git a/rustbook-en/listings/ch02-guessing-game-tutorial/listing-02-01/src/main.rs b/rustbook-en/listings/ch02-guessing-game-tutorial/listing-02-01/src/main.rs index d44e290d..b822b89f 100644 --- a/rustbook-en/listings/ch02-guessing-game-tutorial/listing-02-01/src/main.rs +++ b/rustbook-en/listings/ch02-guessing-game-tutorial/listing-02-01/src/main.rs @@ -25,7 +25,7 @@ fn main() { // ANCHOR_END: expect // ANCHOR: print_guess - println!("You guessed: {guess}"); + println!("You guessed: {}", guess); // ANCHOR_END: print_guess } // ANCHOR: all diff --git a/rustbook-en/listings/ch04-understanding-ownership/listing-04-01/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/listing-04-01/src/main.rs index 148ad84c..ebcd3691 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/listing-04-01/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/listing-04-01/src/main.rs @@ -6,4 +6,4 @@ fn main() { // do stuff with s } // this scope is now over, and s is no longer valid // ANCHOR_END: here -} \ No newline at end of file +} diff --git a/rustbook-en/listings/ch04-understanding-ownership/listing-04-03/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/listing-04-03/src/main.rs index b001cc5f..edf51a94 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/listing-04-03/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/listing-04-03/src/main.rs @@ -14,10 +14,10 @@ fn main() { // special happens. fn takes_ownership(some_string: String) { // some_string comes into scope - println!("{}", some_string); + println!("{some_string}"); } // Here, some_string goes out of scope and `drop` is called. The backing // memory is freed. fn makes_copy(some_integer: i32) { // some_integer comes into scope - println!("{}", some_integer); + println!("{some_integer}"); } // Here, some_integer goes out of scope. Nothing special happens. diff --git a/rustbook-en/listings/ch04-understanding-ownership/listing-04-05/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/listing-04-05/src/main.rs index 22aee141..2782483a 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/listing-04-05/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/listing-04-05/src/main.rs @@ -3,7 +3,7 @@ fn main() { let (s2, len) = calculate_length(s1); - println!("The length of '{}' is {}.", s2, len); + println!("The length of '{s2}' is {len}."); } fn calculate_length(s: String) -> (String, usize) { diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-01-can-mutate-string/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-01-can-mutate-string/src/main.rs index b68f0f1e..15bc9d92 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-01-can-mutate-string/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-01-can-mutate-string/src/main.rs @@ -4,6 +4,6 @@ fn main() { s.push_str(", world!"); // push_str() appends a literal to a String - println!("{}", s); // This will print `hello, world!` - // ANCHOR_END: here + println!("{s}"); // This will print `hello, world!` + // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-04-cant-use-after-move/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-04-cant-use-after-move/src/main.rs index d0b9f187..e35f6d80 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-04-cant-use-after-move/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-04-cant-use-after-move/src/main.rs @@ -3,6 +3,6 @@ fn main() { let s1 = String::from("hello"); let s2 = s1; - println!("{}, world!", s1); + println!("{s1}, world!"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-05-clone/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-05-clone/src/main.rs index 4e61cc1a..0b65e5f6 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-05-clone/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-05-clone/src/main.rs @@ -3,6 +3,6 @@ fn main() { let s1 = String::from("hello"); let s2 = s1.clone(); - println!("s1 = {}, s2 = {}", s1, s2); + println!("s1 = {s1}, s2 = {s2}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-06-copy/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-06-copy/src/main.rs index 63a1fae2..b6fd2445 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-06-copy/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-06-copy/src/main.rs @@ -3,6 +3,6 @@ fn main() { let x = 5; let y = x; - println!("x = {}, y = {}", x, y); + println!("x = {x}, y = {y}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-07-reference/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-07-reference/src/main.rs index fd32a5fc..6f6d5fb2 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-07-reference/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-07-reference/src/main.rs @@ -6,7 +6,7 @@ fn main() { let len = calculate_length(&s1); // ANCHOR_END: here - println!("The length of '{}' is {}.", s1, len); + println!("The length of '{s1}' is {len}."); } fn calculate_length(s: &String) -> usize { diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-08-reference-with-annotations/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-08-reference-with-annotations/src/main.rs index 6686a801..964fd233 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-08-reference-with-annotations/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-08-reference-with-annotations/src/main.rs @@ -3,7 +3,7 @@ fn main() { let len = calculate_length(&s1); - println!("The length of '{}' is {}.", s1, len); + println!("The length of '{s1}' is {len}."); } // ANCHOR: here diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-13-reference-scope-ends/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-13-reference-scope-ends/src/main.rs index 86194496..c005414d 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-13-reference-scope-ends/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-13-reference-scope-ends/src/main.rs @@ -4,10 +4,10 @@ fn main() { let r1 = &s; // no problem let r2 = &s; // no problem - println!("{} and {}", r1, r2); + println!("{r1} and {r2}"); // variables r1 and r2 will not be used after this point let r3 = &mut s; // no problem - println!("{}", r3); + println!("{r3}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch04-understanding-ownership/no-listing-19-slice-error/src/main.rs b/rustbook-en/listings/ch04-understanding-ownership/no-listing-19-slice-error/src/main.rs index 99e04018..b23e45f4 100644 --- a/rustbook-en/listings/ch04-understanding-ownership/no-listing-19-slice-error/src/main.rs +++ b/rustbook-en/listings/ch04-understanding-ownership/no-listing-19-slice-error/src/main.rs @@ -18,6 +18,6 @@ fn main() { s.clear(); // error! - println!("the first word is: {}", word); + println!("the first word is: {word}"); } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch05-using-structs-to-structure-related-data/listing-05-12/src/main.rs b/rustbook-en/listings/ch05-using-structs-to-structure-related-data/listing-05-12/src/main.rs index 2ffc4b8e..67e0b92a 100644 --- a/rustbook-en/listings/ch05-using-structs-to-structure-related-data/listing-05-12/src/main.rs +++ b/rustbook-en/listings/ch05-using-structs-to-structure-related-data/listing-05-12/src/main.rs @@ -10,5 +10,5 @@ fn main() { height: 50, }; - println!("rect1 is {:?}", rect1); + println!("rect1 is {rect1:?}"); } diff --git a/rustbook-en/listings/ch05-using-structs-to-structure-related-data/output-only-02-pretty-debug/src/main.rs b/rustbook-en/listings/ch05-using-structs-to-structure-related-data/output-only-02-pretty-debug/src/main.rs index 84e32aee..f763b50d 100644 --- a/rustbook-en/listings/ch05-using-structs-to-structure-related-data/output-only-02-pretty-debug/src/main.rs +++ b/rustbook-en/listings/ch05-using-structs-to-structure-related-data/output-only-02-pretty-debug/src/main.rs @@ -10,5 +10,5 @@ fn main() { height: 50, }; - println!("rect1 is {:#?}", rect1); + println!("rect1 is {rect1:#?}"); } diff --git a/rustbook-en/listings/ch06-enums-and-pattern-matching/listing-06-06/src/main.rs b/rustbook-en/listings/ch06-enums-and-pattern-matching/listing-06-06/src/main.rs index dc2bffb9..0a037517 100644 --- a/rustbook-en/listings/ch06-enums-and-pattern-matching/listing-06-06/src/main.rs +++ b/rustbook-en/listings/ch06-enums-and-pattern-matching/listing-06-06/src/main.rs @@ -2,7 +2,7 @@ fn main() { // ANCHOR: here let config_max = Some(3u8); match config_max { - Some(max) => println!("The maximum is configured to be {}", max), + Some(max) => println!("The maximum is configured to be {max}"), _ => (), } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-09-variable-in-pattern/src/main.rs b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-09-variable-in-pattern/src/main.rs index a4d500c1..298215d4 100644 --- a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-09-variable-in-pattern/src/main.rs +++ b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-09-variable-in-pattern/src/main.rs @@ -19,7 +19,7 @@ fn value_in_cents(coin: Coin) -> u8 { Coin::Nickel => 5, Coin::Dime => 10, Coin::Quarter(state) => { - println!("State quarter from {:?}!", state); + println!("State quarter from {state:?}!"); 25 } } diff --git a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-12-if-let/src/main.rs b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-12-if-let/src/main.rs index 735086d4..7d7254ea 100644 --- a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-12-if-let/src/main.rs +++ b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-12-if-let/src/main.rs @@ -2,7 +2,7 @@ fn main() { // ANCHOR: here let config_max = Some(3u8); if let Some(max) = config_max { - println!("The maximum is configured to be {}", max); + println!("The maximum is configured to be {max}"); } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-13-count-and-announce-match/src/main.rs b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-13-count-and-announce-match/src/main.rs index 12c4c0fe..d0d7d802 100644 --- a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-13-count-and-announce-match/src/main.rs +++ b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-13-count-and-announce-match/src/main.rs @@ -17,7 +17,7 @@ fn main() { // ANCHOR: here let mut count = 0; match coin { - Coin::Quarter(state) => println!("State quarter from {:?}!", state), + Coin::Quarter(state) => println!("State quarter from {state:?}!"), _ => count += 1, } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-14-count-and-announce-if-let-else/src/main.rs b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-14-count-and-announce-if-let-else/src/main.rs index ba7eda27..3bb36303 100644 --- a/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-14-count-and-announce-if-let-else/src/main.rs +++ b/rustbook-en/listings/ch06-enums-and-pattern-matching/no-listing-14-count-and-announce-if-let-else/src/main.rs @@ -17,7 +17,7 @@ fn main() { // ANCHOR: here let mut count = 0; if let Coin::Quarter(state) = coin { - println!("State quarter from {:?}!", state); + println!("State quarter from {state:?}!"); } else { count += 1; } diff --git a/rustbook-en/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs b/rustbook-en/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs index 7a024a9a..0d9a0ca9 100644 --- a/rustbook-en/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs +++ b/rustbook-en/listings/ch07-managing-growing-projects/quick-reference-example/src/main.rs @@ -4,5 +4,5 @@ pub mod garden; fn main() { let plant = Asparagus {}; - println!("I'm growing {:?}!", plant); + println!("I'm growing {plant:?}!"); } diff --git a/rustbook-en/listings/ch08-common-collections/listing-08-23/src/main.rs b/rustbook-en/listings/ch08-common-collections/listing-08-23/src/main.rs index e8684cf2..29025b41 100644 --- a/rustbook-en/listings/ch08-common-collections/listing-08-23/src/main.rs +++ b/rustbook-en/listings/ch08-common-collections/listing-08-23/src/main.rs @@ -7,6 +7,6 @@ fn main() { scores.insert(String::from("Blue"), 10); scores.insert(String::from("Blue"), 25); - println!("{:?}", scores); + println!("{scores:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch08-common-collections/listing-08-24/src/main.rs b/rustbook-en/listings/ch08-common-collections/listing-08-24/src/main.rs index 3ad97b57..01389563 100644 --- a/rustbook-en/listings/ch08-common-collections/listing-08-24/src/main.rs +++ b/rustbook-en/listings/ch08-common-collections/listing-08-24/src/main.rs @@ -8,6 +8,6 @@ fn main() { scores.entry(String::from("Yellow")).or_insert(50); scores.entry(String::from("Blue")).or_insert(50); - println!("{:?}", scores); + println!("{scores:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch08-common-collections/listing-08-25/src/main.rs b/rustbook-en/listings/ch08-common-collections/listing-08-25/src/main.rs index f3f6aa16..84dd1cd4 100644 --- a/rustbook-en/listings/ch08-common-collections/listing-08-25/src/main.rs +++ b/rustbook-en/listings/ch08-common-collections/listing-08-25/src/main.rs @@ -11,6 +11,6 @@ fn main() { *count += 1; } - println!("{:?}", map); + println!("{map:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch09-error-handling/listing-09-04/src/main.rs b/rustbook-en/listings/ch09-error-handling/listing-09-04/src/main.rs index 69da109f..832f57f0 100644 --- a/rustbook-en/listings/ch09-error-handling/listing-09-04/src/main.rs +++ b/rustbook-en/listings/ch09-error-handling/listing-09-04/src/main.rs @@ -5,6 +5,6 @@ fn main() { let greeting_file = match greeting_file_result { Ok(file) => file, - Err(error) => panic!("Problem opening the file: {:?}", error), + Err(error) => panic!("Problem opening the file: {error:?}"), }; } diff --git a/rustbook-en/listings/ch09-error-handling/listing-09-05/src/main.rs b/rustbook-en/listings/ch09-error-handling/listing-09-05/src/main.rs index 83ea0104..e0bc55c3 100644 --- a/rustbook-en/listings/ch09-error-handling/listing-09-05/src/main.rs +++ b/rustbook-en/listings/ch09-error-handling/listing-09-05/src/main.rs @@ -9,10 +9,10 @@ fn main() { Err(error) => match error.kind() { ErrorKind::NotFound => match File::create("hello.txt") { Ok(fc) => fc, - Err(e) => panic!("Problem creating the file: {:?}", e), + Err(e) => panic!("Problem creating the file: {e:?}"), }, other_error => { - panic!("Problem opening the file: {:?}", other_error); + panic!("Problem opening the file: {other_error:?}"); } }, }; diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-01/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-01/src/main.rs index a4dba7ed..c9e9bbbd 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-01/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-01/src/main.rs @@ -10,7 +10,7 @@ fn main() { } } - println!("The largest number is {}", largest); + println!("The largest number is {largest}"); // ANCHOR_END: here assert_eq!(*largest, 100); // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-02/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-02/src/main.rs index 8c523a8b..fd43154a 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-02/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-02/src/main.rs @@ -9,7 +9,7 @@ fn main() { } } - println!("The largest number is {}", largest); + println!("The largest number is {largest}"); let number_list = vec![102, 34, 6000, 89, 54, 2, 43, 8]; @@ -21,5 +21,5 @@ fn main() { } } - println!("The largest number is {}", largest); + println!("The largest number is {largest}"); } diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-03/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-03/src/main.rs index 89922290..1878f5aa 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-03/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-03/src/main.rs @@ -15,7 +15,7 @@ fn main() { let number_list = vec![34, 50, 25, 100, 65]; let result = largest(&number_list); - println!("The largest number is {}", result); + println!("The largest number is {result}"); // ANCHOR_END: here assert_eq!(*result, 100); // ANCHOR: here @@ -23,7 +23,7 @@ fn main() { let number_list = vec![102, 34, 6000, 89, 54, 2, 43, 8]; let result = largest(&number_list); - println!("The largest number is {}", result); + println!("The largest number is {result}"); // ANCHOR_END: here assert_eq!(*result, 6000); // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-04/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-04/src/main.rs index a47e3f23..ac3b1f7c 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-04/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-04/src/main.rs @@ -27,7 +27,7 @@ fn main() { let number_list = vec![34, 50, 25, 100, 65]; let result = largest_i32(&number_list); - println!("The largest number is {}", result); + println!("The largest number is {result}"); // ANCHOR_END: here assert_eq!(*result, 100); // ANCHOR: here @@ -35,7 +35,7 @@ fn main() { let char_list = vec!['y', 'm', 'a', 'q']; let result = largest_char(&char_list); - println!("The largest char is {}", result); + println!("The largest char is {result}"); // ANCHOR_END: here assert_eq!(*result, 'y'); // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/src/main.rs index df33743f..094eb416 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/src/main.rs @@ -14,10 +14,10 @@ fn main() { let number_list = vec![34, 50, 25, 100, 65]; let result = largest(&number_list); - println!("The largest number is {}", result); + println!("The largest number is {result}"); let char_list = vec!['y', 'm', 'a', 'q']; let result = largest(&char_list); - println!("The largest char is {}", result); + println!("The largest char is {result}"); } diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-16/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-16/src/main.rs index d71134ea..773340ea 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-16/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-16/src/main.rs @@ -6,5 +6,5 @@ fn main() { r = &x; } - println!("r: {}", r); + println!("r: {r}"); } diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-17/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-17/src/main.rs index e8ca9232..6679bcf3 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-17/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-17/src/main.rs @@ -6,5 +6,5 @@ fn main() { r = &x; // | | } // -+ | // | - println!("r: {}", r); // | + println!("r: {r}"); // | } // ---------+ diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-18/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-18/src/main.rs index 09ae3919..634ff939 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-18/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-18/src/main.rs @@ -3,6 +3,6 @@ fn main() { // | let r = &x; // --+-- 'a | // | | - println!("r: {}", r); // | | + println!("r: {r}"); // | | // --+ | } // ----------+ diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-19/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-19/src/main.rs index 0f076a71..8b64cd00 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-19/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-19/src/main.rs @@ -3,5 +3,5 @@ fn main() { let string2 = "xyz"; let result = longest(string1.as_str(), string2); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-20/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-20/src/main.rs index 6af8c9f0..bf41acd1 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-20/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-20/src/main.rs @@ -3,7 +3,7 @@ fn main() { let string2 = "xyz"; let result = longest(string1.as_str(), string2); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/src/main.rs index 09c3a0da..7668de13 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-21/src/main.rs @@ -3,7 +3,7 @@ fn main() { let string2 = "xyz"; let result = longest(string1.as_str(), string2); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-22/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-22/src/main.rs index 836ec729..fc9ff296 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-22/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-22/src/main.rs @@ -5,7 +5,7 @@ fn main() { { let string2 = String::from("xyz"); let result = longest(string1.as_str(), string2.as_str()); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/output.txt b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/output.txt index 471347c6..63d1668c 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/output.txt +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/output.txt @@ -9,8 +9,8 @@ error[E0597]: `string2` does not live long enough | ^^^^^^^ borrowed value does not live long enough 7 | } | - `string2` dropped here while still borrowed -8 | println!("The longest string is {}", result); - | ------ borrow later used here +8 | println!("The longest string is {result}"); + | ------ borrow later used here For more information about this error, try `rustc --explain E0597`. error: could not compile `chapter10` (bin "chapter10") due to 1 previous error diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/src/main.rs index 2a6fa589..f2e63386 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/listing-10-23/src/main.rs @@ -6,7 +6,7 @@ fn main() { let string2 = String::from("xyz"); result = longest(string1.as_str(), string2.as_str()); } - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-08-only-one-reference-with-lifetime/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-08-only-one-reference-with-lifetime/src/main.rs index d144305c..4c35d90e 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-08-only-one-reference-with-lifetime/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-08-only-one-reference-with-lifetime/src/main.rs @@ -3,7 +3,7 @@ fn main() { let string2 = "efghijklmnopqrstuvwxyz"; let result = longest(string1.as_str(), string2); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-09-unrelated-lifetime/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-09-unrelated-lifetime/src/main.rs index aca4be0a..4d596ec4 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-09-unrelated-lifetime/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-09-unrelated-lifetime/src/main.rs @@ -3,7 +3,7 @@ fn main() { let string2 = "xyz"; let result = longest(string1.as_str(), string2); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR: here diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs index 32ad530b..b8222308 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-10-lifetimes-on-methods/src/main.rs @@ -13,7 +13,7 @@ impl<'a> ImportantExcerpt<'a> { // ANCHOR: 3rd impl<'a> ImportantExcerpt<'a> { fn announce_and_return_part(&self, announcement: &str) -> &str { - println!("Attention please: {}", announcement); + println!("Attention please: {announcement}"); self.part } } diff --git a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-11-generics-traits-and-lifetimes/src/main.rs b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-11-generics-traits-and-lifetimes/src/main.rs index cfafa9a6..4b0201fb 100644 --- a/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-11-generics-traits-and-lifetimes/src/main.rs +++ b/rustbook-en/listings/ch10-generic-types-traits-and-lifetimes/no-listing-11-generics-traits-and-lifetimes/src/main.rs @@ -7,7 +7,7 @@ fn main() { string2, "Today is someone's birthday!", ); - println!("The longest string is {}", result); + println!("The longest string is {result}"); } // ANCHOR: here @@ -21,7 +21,7 @@ fn longest_with_an_announcement<'a, T>( where T: Display, { - println!("Announcement! {}", ann); + println!("Announcement! {ann}"); if x.len() > y.len() { x } else { diff --git a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs index 6fd76ce0..99fc06b8 100644 --- a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs +++ b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-10/src/lib.rs @@ -1,5 +1,5 @@ fn prints_and_returns_10(a: i32) -> i32 { - println!("I got the value {}", a); + println!("I got the value {a}"); 10 } diff --git a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs index e26fa710..3822d6b9 100644 --- a/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs +++ b/rustbook-en/listings/ch11-writing-automated-tests/listing-11-13/tests/integration_test.rs @@ -1,6 +1,6 @@ -use adder; +use adder::add_two; #[test] fn it_adds_two() { - assert_eq!(4, adder::add_two(2)); + assert_eq!(4, add_two(2)); } diff --git a/rustbook-en/listings/ch11-writing-automated-tests/no-listing-05-greeter/src/lib.rs b/rustbook-en/listings/ch11-writing-automated-tests/no-listing-05-greeter/src/lib.rs index 3ba3d881..433cf148 100644 --- a/rustbook-en/listings/ch11-writing-automated-tests/no-listing-05-greeter/src/lib.rs +++ b/rustbook-en/listings/ch11-writing-automated-tests/no-listing-05-greeter/src/lib.rs @@ -1,5 +1,5 @@ pub fn greeting(name: &str) -> String { - format!("Hello {}!", name) + format!("Hello {name}!") } #[cfg(test)] diff --git a/rustbook-en/listings/ch11-writing-automated-tests/output-only-01-show-output/src/lib.rs b/rustbook-en/listings/ch11-writing-automated-tests/output-only-01-show-output/src/lib.rs index 43c4c92f..462d2247 100644 --- a/rustbook-en/listings/ch11-writing-automated-tests/output-only-01-show-output/src/lib.rs +++ b/rustbook-en/listings/ch11-writing-automated-tests/output-only-01-show-output/src/lib.rs @@ -1,5 +1,5 @@ pub fn prints_and_returns_10(a: i32) -> i32 { - println!("I got the value {}", a); + println!("I got the value {a}"); 10 } diff --git a/rustbook-en/listings/ch12-an-io-project/listing-12-02/src/main.rs b/rustbook-en/listings/ch12-an-io-project/listing-12-02/src/main.rs index ae2fa7bb..afc3c3c9 100644 --- a/rustbook-en/listings/ch12-an-io-project/listing-12-02/src/main.rs +++ b/rustbook-en/listings/ch12-an-io-project/listing-12-02/src/main.rs @@ -6,6 +6,6 @@ fn main() { let query = &args[1]; let file_path = &args[2]; - println!("Searching for {}", query); - println!("In file {}", file_path); + println!("Searching for {query}"); + println!("In file {file_path}"); } diff --git a/rustbook-en/listings/ch12-an-io-project/listing-12-03/src/main.rs b/rustbook-en/listings/ch12-an-io-project/listing-12-03/src/main.rs index ae2fa7bb..afc3c3c9 100644 --- a/rustbook-en/listings/ch12-an-io-project/listing-12-03/src/main.rs +++ b/rustbook-en/listings/ch12-an-io-project/listing-12-03/src/main.rs @@ -6,6 +6,6 @@ fn main() { let query = &args[1]; let file_path = &args[2]; - println!("Searching for {}", query); - println!("In file {}", file_path); + println!("Searching for {query}"); + println!("In file {file_path}"); } diff --git a/rustbook-en/listings/ch12-an-io-project/listing-12-04/src/main.rs b/rustbook-en/listings/ch12-an-io-project/listing-12-04/src/main.rs index 944e4300..f3432497 100644 --- a/rustbook-en/listings/ch12-an-io-project/listing-12-04/src/main.rs +++ b/rustbook-en/listings/ch12-an-io-project/listing-12-04/src/main.rs @@ -10,9 +10,9 @@ fn main() { let query = &args[1]; let file_path = &args[2]; - println!("Searching for {}", query); + println!("Searching for {query}"); // ANCHOR: here - println!("In file {}", file_path); + println!("In file {file_path}"); let contents = fs::read_to_string(file_path) .expect("Should have been able to read the file"); diff --git a/rustbook-en/listings/ch12-an-io-project/listing-12-05/src/main.rs b/rustbook-en/listings/ch12-an-io-project/listing-12-05/src/main.rs index 06159183..838cacf3 100644 --- a/rustbook-en/listings/ch12-an-io-project/listing-12-05/src/main.rs +++ b/rustbook-en/listings/ch12-an-io-project/listing-12-05/src/main.rs @@ -10,8 +10,8 @@ fn main() { // --snip-- // ANCHOR_END: here - println!("Searching for {}", query); - println!("In file {}", file_path); + println!("Searching for {query}"); + println!("In file {file_path}"); let contents = fs::read_to_string(file_path) .expect("Should have been able to read the file"); diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-04/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-04/src/main.rs index 43b91bb3..19f51a6f 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-04/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-04/src/main.rs @@ -1,10 +1,10 @@ fn main() { let list = vec![1, 2, 3]; - println!("Before defining closure: {:?}", list); + println!("Before defining closure: {list:?}"); - let only_borrows = || println!("From closure: {:?}", list); + let only_borrows = || println!("From closure: {list:?}"); - println!("Before calling closure: {:?}", list); + println!("Before calling closure: {list:?}"); only_borrows(); - println!("After calling closure: {:?}", list); + println!("After calling closure: {list:?}"); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-05/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-05/src/main.rs index 37f8130e..f6c2a53d 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-05/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-05/src/main.rs @@ -1,9 +1,9 @@ fn main() { let mut list = vec![1, 2, 3]; - println!("Before defining closure: {:?}", list); + println!("Before defining closure: {list:?}"); let mut borrows_mutably = || list.push(7); borrows_mutably(); - println!("After calling closure: {:?}", list); + println!("After calling closure: {list:?}"); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-06/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-06/src/main.rs index 2c8e18c9..ee9ca045 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-06/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-06/src/main.rs @@ -2,9 +2,9 @@ use std::thread; fn main() { let list = vec![1, 2, 3]; - println!("Before defining closure: {:?}", list); + println!("Before defining closure: {list:?}"); - thread::spawn(move || println!("From thread: {:?}", list)) + thread::spawn(move || println!("From thread: {list:?}")) .join() .unwrap(); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-07/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-07/src/main.rs index 73a25e5f..e7ab8d34 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-07/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-07/src/main.rs @@ -12,5 +12,5 @@ fn main() { ]; list.sort_by_key(|r| r.width); - println!("{:#?}", list); + println!("{list:#?}"); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-08/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-08/src/main.rs index 1b60f1f6..e00fec70 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-08/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-08/src/main.rs @@ -18,5 +18,5 @@ fn main() { sort_operations.push(value); r.width }); - println!("{:#?}", list); + println!("{list:#?}"); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-09/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-09/src/main.rs index a60d6fd3..f007e3c0 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-09/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-09/src/main.rs @@ -16,5 +16,5 @@ fn main() { num_sort_operations += 1; r.width }); - println!("{:#?}, sorted in {num_sort_operations} operations", list); + println!("{list:#?}, sorted in {num_sort_operations} operations"); } diff --git a/rustbook-en/listings/ch13-functional-features/listing-13-11/src/main.rs b/rustbook-en/listings/ch13-functional-features/listing-13-11/src/main.rs index 712aff40..b4e85169 100644 --- a/rustbook-en/listings/ch13-functional-features/listing-13-11/src/main.rs +++ b/rustbook-en/listings/ch13-functional-features/listing-13-11/src/main.rs @@ -5,7 +5,7 @@ fn main() { let v1_iter = v1.iter(); for val in v1_iter { - println!("Got: {}", val); + println!("Got: {val}"); } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch15-smart-pointers/listing-15-01/src/main.rs b/rustbook-en/listings/ch15-smart-pointers/listing-15-01/src/main.rs index 8da1d905..97f04f38 100644 --- a/rustbook-en/listings/ch15-smart-pointers/listing-15-01/src/main.rs +++ b/rustbook-en/listings/ch15-smart-pointers/listing-15-01/src/main.rs @@ -1,4 +1,4 @@ fn main() { let b = Box::new(5); - println!("b = {}", b); + println!("b = {b}"); } diff --git a/rustbook-en/listings/ch15-smart-pointers/listing-15-24/src/main.rs b/rustbook-en/listings/ch15-smart-pointers/listing-15-24/src/main.rs index e225bd86..e3dda1a1 100644 --- a/rustbook-en/listings/ch15-smart-pointers/listing-15-24/src/main.rs +++ b/rustbook-en/listings/ch15-smart-pointers/listing-15-24/src/main.rs @@ -18,7 +18,7 @@ fn main() { *value.borrow_mut() += 10; - println!("a after = {:?}", a); - println!("b after = {:?}", b); - println!("c after = {:?}", c); + println!("a after = {a:?}"); + println!("b after = {b:?}"); + println!("c after = {c:?}"); } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-01/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-01/src/main.rs index 6305a98e..ea10ba28 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-01/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-01/src/main.rs @@ -4,13 +4,13 @@ use std::time::Duration; fn main() { thread::spawn(|| { for i in 1..10 { - println!("hi number {} from the spawned thread!", i); + println!("hi number {i} from the spawned thread!"); thread::sleep(Duration::from_millis(1)); } }); for i in 1..5 { - println!("hi number {} from the main thread!", i); + println!("hi number {i} from the main thread!"); thread::sleep(Duration::from_millis(1)); } } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-02/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-02/src/main.rs index e37607f1..33bf53f4 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-02/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-02/src/main.rs @@ -4,13 +4,13 @@ use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { - println!("hi number {} from the spawned thread!", i); + println!("hi number {i} from the spawned thread!"); thread::sleep(Duration::from_millis(1)); } }); for i in 1..5 { - println!("hi number {} from the main thread!", i); + println!("hi number {i} from the main thread!"); thread::sleep(Duration::from_millis(1)); } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/output.txt b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/output.txt index f90a9bcf..3de4d4d3 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/output.txt +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/output.txt @@ -5,15 +5,15 @@ error[E0373]: closure may outlive the current function, but it borrows `v`, whic | 6 | let handle = thread::spawn(|| { | ^^ may outlive borrowed value `v` -7 | println!("Here's a vector: {:?}", v); - | - `v` is borrowed here +7 | println!("Here's a vector: {v:?}"); + | - `v` is borrowed here | note: function requires argument type to outlive `'static` --> src/main.rs:6:18 | 6 | let handle = thread::spawn(|| { | __________________^ -7 | | println!("Here's a vector: {:?}", v); +7 | | println!("Here's a vector: {v:?}"); 8 | | }); | |______^ help: to force the closure to take ownership of `v` (and any other referenced variables), use the `move` keyword diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/src/main.rs index defc8764..b2231c5b 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-03/src/main.rs @@ -4,7 +4,7 @@ fn main() { let v = vec![1, 2, 3]; let handle = thread::spawn(|| { - println!("Here's a vector: {:?}", v); + println!("Here's a vector: {v:?}"); }); handle.join().unwrap(); diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-04/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-04/src/main.rs index 0bccc5f5..f0a9058a 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-04/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-04/src/main.rs @@ -4,7 +4,7 @@ fn main() { let v = vec![1, 2, 3]; let handle = thread::spawn(|| { - println!("Here's a vector: {:?}", v); + println!("Here's a vector: {v:?}"); }); drop(v); // oh no! diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-05/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-05/src/main.rs index a6547dc4..76783e61 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-05/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-05/src/main.rs @@ -4,7 +4,7 @@ fn main() { let v = vec![1, 2, 3]; let handle = thread::spawn(move || { - println!("Here's a vector: {:?}", v); + println!("Here's a vector: {v:?}"); }); handle.join().unwrap(); diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-08/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-08/src/main.rs index fbba9167..e7ac452d 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-08/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-08/src/main.rs @@ -10,5 +10,5 @@ fn main() { }); let received = rx.recv().unwrap(); - println!("Got: {}", received); + println!("Got: {received}"); } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/output.txt b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/output.txt index b3288575..d521ebbb 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/output.txt +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/output.txt @@ -7,8 +7,8 @@ error[E0382]: borrow of moved value: `val` | --- move occurs because `val` has type `String`, which does not implement the `Copy` trait 9 | tx.send(val).unwrap(); | --- value moved here -10 | println!("val is {}", val); - | ^^^ value borrowed here after move +10 | println!("val is {val}"); + | ^^^ value borrowed here after move | = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider cloning the value if the performance cost is acceptable diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/src/main.rs index 98a8129a..fe20d347 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-09/src/main.rs @@ -7,9 +7,9 @@ fn main() { thread::spawn(move || { let val = String::from("hi"); tx.send(val).unwrap(); - println!("val is {}", val); + println!("val is {val}"); }); let received = rx.recv().unwrap(); - println!("Got: {}", received); + println!("Got: {received}"); } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-10/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-10/src/main.rs index 82b220de..c9702bd8 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-10/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-10/src/main.rs @@ -20,6 +20,6 @@ fn main() { }); for received in rx { - println!("Got: {}", received); + println!("Got: {received}"); } } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-11/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-11/src/main.rs index d92deab5..174a5d14 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-11/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-11/src/main.rs @@ -38,7 +38,7 @@ fn main() { }); for received in rx { - println!("Got: {}", received); + println!("Got: {received}"); } // --snip-- diff --git a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-12/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-12/src/main.rs index 0c0d6767..99ba5b48 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/listing-16-12/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/listing-16-12/src/main.rs @@ -8,5 +8,5 @@ fn main() { *num = 6; } - println!("m = {:?}", m); + println!("m = {m:?}"); } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/no-listing-01-join-too-early/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/no-listing-01-join-too-early/src/main.rs index 6205e57d..7023a90f 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/no-listing-01-join-too-early/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/no-listing-01-join-too-early/src/main.rs @@ -4,7 +4,7 @@ use std::time::Duration; fn main() { let handle = thread::spawn(|| { for i in 1..10 { - println!("hi number {} from the spawned thread!", i); + println!("hi number {i} from the spawned thread!"); thread::sleep(Duration::from_millis(1)); } }); @@ -12,7 +12,7 @@ fn main() { handle.join().unwrap(); for i in 1..5 { - println!("hi number {} from the main thread!", i); + println!("hi number {i} from the main thread!"); thread::sleep(Duration::from_millis(1)); } } diff --git a/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/output.txt b/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/output.txt index 269f1a95..929354c1 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/output.txt +++ b/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/output.txt @@ -8,8 +8,8 @@ error[E0382]: use of moved value: `v` 5 | 6 | let handle = thread::spawn(move || { | ------- value moved into closure here -7 | println!("Here's a vector: {:?}", v); - | - variable moved due to use in closure +7 | println!("Here's a vector: {v:?}"); + | - variable moved due to use in closure ... 10 | drop(v); // oh no! | ^ value used here after move diff --git a/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/src/main.rs b/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/src/main.rs index 70f659c5..cc71cbab 100644 --- a/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/src/main.rs +++ b/rustbook-en/listings/ch16-fearless-concurrency/output-only-01-move-drop/src/main.rs @@ -4,7 +4,7 @@ fn main() { let v = vec![1, 2, 3]; let handle = thread::spawn(move || { - println!("Here's a vector: {:?}", v); + println!("Here's a vector: {v:?}"); }); drop(v); // oh no! diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-02/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-02/src/main.rs index 5f75a4f2..2479d845 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-02/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-02/src/main.rs @@ -7,7 +7,7 @@ fn main() { stack.push(3); while let Some(top) = stack.pop() { - println!("{}", top); + println!("{top}"); } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-03/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-03/src/main.rs index eb922d62..218c1806 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-03/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-03/src/main.rs @@ -3,7 +3,7 @@ fn main() { let v = vec!['a', 'b', 'c']; for (index, value) in v.iter().enumerate() { - println!("{} is at index {}", value, index); + println!("{value} is at index {index}"); } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-07/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-07/src/main.rs index 4eccb808..70069424 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-07/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-07/src/main.rs @@ -1,5 +1,5 @@ fn print_coordinates(&(x, y): &(i32, i32)) { - println!("Current location: ({}, {})", x, y); + println!("Current location: ({x}, {y})"); } fn main() { diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-09/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-09/src/main.rs index d6274fc0..e378c370 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-09/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-09/src/main.rs @@ -2,7 +2,7 @@ fn main() { let some_option_value: Option = None; // ANCHOR: here if let Some(x) = some_option_value { - println!("{}", x); + println!("{x}"); } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-10/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-10/src/main.rs index cb81772e..2073948e 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-10/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-10/src/main.rs @@ -1,7 +1,7 @@ fn main() { // ANCHOR: here if let x = 5 { - println!("{}", x); + println!("{x}"); }; // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-11/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-11/src/main.rs index db942b7a..05521280 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-11/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-11/src/main.rs @@ -6,9 +6,9 @@ fn main() { match x { Some(50) => println!("Got 50"), Some(y) => println!("Matched, y = {y}"), - _ => println!("Default case, x = {:?}", x), + _ => println!("Default case, x = {x:?}"), } - println!("at the end: x = {:?}, y = {y}", x); + println!("at the end: x = {x:?}, y = {y}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-15/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-15/src/main.rs index a3138b22..9407cc16 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-15/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-15/src/main.rs @@ -19,7 +19,7 @@ fn main() { println!("Text message: {text}"); } Message::ChangeColor(r, g, b) => { - println!("Change the color to red {r}, green {g}, and blue {b}",) + println!("Change the color to red {r}, green {g}, and blue {b}") } } } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-17/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-17/src/main.rs index cf1fbe07..70538603 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-17/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-17/src/main.rs @@ -1,5 +1,5 @@ fn foo(_: i32, y: i32) { - println!("This code only uses the y parameter: {}", y); + println!("This code only uses the y parameter: {y}"); } fn main() { diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-18/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-18/src/main.rs index b776c64c..2b887762 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-18/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-18/src/main.rs @@ -12,6 +12,6 @@ fn main() { } } - println!("setting is {:?}", setting_value); + println!("setting is {setting_value:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-21/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-21/src/main.rs index 98061050..320db62f 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-21/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-21/src/main.rs @@ -6,6 +6,6 @@ fn main() { println!("found a string"); } - println!("{:?}", s); + println!("{s:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-22/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-22/src/main.rs index e2faa345..9df1492b 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-22/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-22/src/main.rs @@ -6,6 +6,6 @@ fn main() { println!("found a string"); } - println!("{:?}", s); + println!("{s:?}"); // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-23/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-23/src/main.rs index 7a9d9bb3..491d6c53 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-23/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-23/src/main.rs @@ -9,7 +9,7 @@ fn main() { let origin = Point { x: 0, y: 0, z: 0 }; match origin { - Point { x, .. } => println!("x is {}", x), + Point { x, .. } => println!("x is {x}"), } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-25/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-25/src/main.rs index b90884eb..6c3b24b7 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-25/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-25/src/main.rs @@ -3,7 +3,7 @@ fn main() { match numbers { (.., second, ..) => { - println!("Some numbers: {}", second) + println!("Some numbers: {second}") }, } } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-26/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-26/src/main.rs index 41fce979..2566169a 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-26/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-26/src/main.rs @@ -3,8 +3,8 @@ fn main() { let num = Some(4); match num { - Some(x) if x % 2 == 0 => println!("The number {} is even", x), - Some(x) => println!("The number {} is odd", x), + Some(x) if x % 2 == 0 => println!("The number {x} is even"), + Some(x) => println!("The number {x} is odd"), None => (), } // ANCHOR_END: here diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-27/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-27/src/main.rs index 8386a0ab..06fd9499 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-27/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-27/src/main.rs @@ -5,8 +5,8 @@ fn main() { match x { Some(50) => println!("Got 50"), Some(n) if n == y => println!("Matched, n = {n}"), - _ => println!("Default case, x = {:?}", x), + _ => println!("Default case, x = {x:?}"), } - println!("at the end: x = {:?}, y = {y}", x); + println!("at the end: x = {x:?}, y = {y}"); } diff --git a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-29/src/main.rs b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-29/src/main.rs index 3514deb6..e36fda87 100644 --- a/rustbook-en/listings/ch18-patterns-and-matching/listing-18-29/src/main.rs +++ b/rustbook-en/listings/ch18-patterns-and-matching/listing-18-29/src/main.rs @@ -9,11 +9,11 @@ fn main() { match msg { Message::Hello { id: id_variable @ 3..=7, - } => println!("Found an id in range: {}", id_variable), + } => println!("Found an id in range: {id_variable}"), Message::Hello { id: 10..=12 } => { println!("Found an id in another range") } - Message::Hello { id } => println!("Found some other id: {}", id), + Message::Hello { id } => println!("Found some other id: {id}"), } // ANCHOR_END: here } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-09/src/main.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-09/src/main.rs index 82a4b421..fda5179a 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-09/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-09/src/main.rs @@ -1,5 +1,5 @@ static HELLO_WORLD: &str = "Hello, world!"; fn main() { - println!("name is: {}", HELLO_WORLD); + println!("name is: {HELLO_WORLD}"); } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-10/src/main.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-10/src/main.rs index e8dab68e..b5559fd3 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-10/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-10/src/main.rs @@ -10,6 +10,6 @@ fn main() { add_to_count(3); unsafe { - println!("COUNTER: {}", COUNTER); + println!("COUNTER: {COUNTER}"); } } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-22/src/main.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-22/src/main.rs index febe58b0..7069fef1 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-22/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-22/src/main.rs @@ -7,7 +7,7 @@ trait OutlinePrint: fmt::Display { let len = output.len(); println!("{}", "*".repeat(len + 4)); println!("*{}*", " ".repeat(len + 2)); - println!("* {} *", output); + println!("* {output} *"); println!("*{}*", " ".repeat(len + 2)); println!("{}", "*".repeat(len + 4)); } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-23/src/main.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-23/src/main.rs index eae46c92..f8c8366b 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-23/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-23/src/main.rs @@ -10,5 +10,5 @@ impl fmt::Display for Wrapper { fn main() { let w = Wrapper(vec![String::from("hello"), String::from("world")]); - println!("w = {}", w); + println!("w = {w}"); } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-27/src/main.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-27/src/main.rs index 91b2cf04..312df241 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-27/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-27/src/main.rs @@ -9,5 +9,5 @@ fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 { fn main() { let answer = do_twice(add_one, 5); - println!("The answer is: {}", answer); + println!("The answer is: {answer}"); } diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac..6be987b2 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs index 11643a8d..839ec835 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-31/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac..6be987b2 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml index aa076ac4..ed9e917a 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" diff --git a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs index dac6c98f..ba1215f5 100644 --- a/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/listing-19-33/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/src/main.rs b/rustbook-en/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/src/main.rs index a1e2fe4c..0e45f3c2 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-02-impl-outlineprint-for-point/src/main.rs @@ -6,7 +6,7 @@ trait OutlinePrint: fmt::Display { let len = output.len(); println!("{}", "*".repeat(len + 4)); println!("*{}*", " ".repeat(len + 2)); - println!("* {} *", output); + println!("* {output} *"); println!("*{}*", " ".repeat(len + 2)); println!("{}", "*".repeat(len + 4)); } diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-03-impl-display-for-point/src/main.rs b/rustbook-en/listings/ch19-advanced-features/no-listing-03-impl-display-for-point/src/main.rs index c7bbb6a7..fa5be1c7 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-03-impl-display-for-point/src/main.rs +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-03-impl-display-for-point/src/main.rs @@ -4,7 +4,7 @@ trait OutlinePrint: fmt::Display { let len = output.len(); println!("{}", "*".repeat(len + 4)); println!("*{}*", " ".repeat(len + 2)); - println!("* {} *", output); + println!("* {output} *"); println!("*{}*", " ".repeat(len + 2)); println!("{}", "*".repeat(len + 4)); } diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock index 9a38c8ac..6be987b2 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.lock @@ -1,46 +1,46 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml index aa076ac4..ed9e917a 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" proc-macro = true [dependencies] -syn = "1.0" +syn = "2.0" quote = "1.0" diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs index 5e0b96c2..654b6bee 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/hello_macro/hello_macro_derive/src/lib.rs @@ -1,6 +1,5 @@ use proc_macro::TokenStream; use quote::quote; -use syn; #[proc_macro_derive(HelloMacro)] pub fn hello_macro_derive(input: TokenStream) -> TokenStream { diff --git a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock index dee23ecf..3849f152 100644 --- a/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock +++ b/rustbook-en/listings/ch19-advanced-features/no-listing-21-pancakes/pancakes/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "hello_macro" version = "0.1.0" @@ -8,51 +10,49 @@ version = "0.1.0" name = "hello_macro_derive" version = "0.1.0" dependencies = [ - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "quote", + "syn", ] [[package]] name = "pancakes" version = "0.1.0" dependencies = [ - "hello_macro 0.1.0", - "hello_macro_derive 0.1.0", + "hello_macro", + "hello_macro_derive", ] [[package]] name = "proc-macro2" -version = "1.0.8" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.2" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", ] [[package]] name = "syn" -version = "1.0.14" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ - "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "unicode-xid" -version = "0.2.0" +name = "unicode-ident" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/rustbook-en/listings/ch20-web-server/listing-20-02/src/main.rs b/rustbook-en/listings/ch20-web-server/listing-20-02/src/main.rs index 7240c73c..f139846c 100644 --- a/rustbook-en/listings/ch20-web-server/listing-20-02/src/main.rs +++ b/rustbook-en/listings/ch20-web-server/listing-20-02/src/main.rs @@ -21,5 +21,5 @@ fn handle_connection(mut stream: TcpStream) { .take_while(|line| !line.is_empty()) .collect(); - println!("Request: {:#?}", http_request); + println!("Request: {http_request:#?}"); } diff --git a/rustbook-en/redirects/choosing-your-guarantees.md b/rustbook-en/redirects/choosing-your-guarantees.md index 3667258c..d8a4e3a3 100644 --- a/rustbook-en/redirects/choosing-your-guarantees.md +++ b/rustbook-en/redirects/choosing-your-guarantees.md @@ -7,7 +7,7 @@ ```rust let b = Box::new(5); -println!("b = {}", b); +println!("b = {b}"); ``` --- diff --git a/rustbook-en/redirects/iterators.md b/rustbook-en/redirects/iterators.md index 26cb0476..d8a73dab 100644 --- a/rustbook-en/redirects/iterators.md +++ b/rustbook-en/redirects/iterators.md @@ -11,7 +11,7 @@ let v1 = vec![1, 2, 3]; let v1_iter = v1.iter(); for val in v1_iter { - println!("Got: {}", val); + println!("Got: {val}"); } ``` diff --git a/rustbook-en/redirects/lifetimes.md b/rustbook-en/redirects/lifetimes.md index 21ddb38c..8a27ec17 100644 --- a/rustbook-en/redirects/lifetimes.md +++ b/rustbook-en/redirects/lifetimes.md @@ -11,7 +11,7 @@ // | let r = &x; // --+--+-- 'a // | | - println!("r: {}", r); // | | + println!("r: {r}"); // | | // --+ | } // -----+ ``` diff --git a/rustbook-en/redirects/loops.md b/rustbook-en/redirects/loops.md index 1686c115..30c7d405 100644 --- a/rustbook-en/redirects/loops.md +++ b/rustbook-en/redirects/loops.md @@ -14,17 +14,17 @@ loop { let mut number = 3; while number != 0 { - println!("{}!", number); + println!("{number}!"); number = number - 1; } let a = [10, 20, 30, 40, 50]; for element in a.iter() { - println!("the value is: {}", element); + println!("the value is: {element}"); } ``` --- You can find the latest version of this information -[here](ch03-05-control-flow.html#repetition-with-loops). \ No newline at end of file +[here](ch03-05-control-flow.html#repetition-with-loops). diff --git a/rustbook-en/redirects/mutability.md b/rustbook-en/redirects/mutability.md index 89fc3b6f..4e64953c 100644 --- a/rustbook-en/redirects/mutability.md +++ b/rustbook-en/redirects/mutability.md @@ -6,9 +6,9 @@ ```rust let mut x = 5; -println!("The value of x is: {}", x); +println!("The value of x is: {x}"); x = 6; -println!("The value of x is: {}", x); +println!("The value of x is: {x}"); ``` --- diff --git a/rustbook-en/src/appendix-04-useful-development-tools.md b/rustbook-en/src/appendix-04-useful-development-tools.md index 40b07615..30249ed5 100644 --- a/rustbook-en/src/appendix-04-useful-development-tools.md +++ b/rustbook-en/src/appendix-04-useful-development-tools.md @@ -95,7 +95,7 @@ fn main() { The `for` loop variable is now named `_i`, and the warning no longer appears. You can also use the `cargo fix` command to transition your code between -different Rust editions. Editions are covered in Appendix E. +different Rust editions. Editions are covered in [Appendix E][editions]. ### More Lints with Clippy @@ -178,3 +178,4 @@ particular IDE. Your IDE will gain abilities such as autocompletion, jump to definition, and inline errors. [rust-analyzer]: https://rust-analyzer.github.io +[editions]: appendix-05-editions.md diff --git a/rustbook-en/src/ch02-00-guessing-game-tutorial.md b/rustbook-en/src/ch02-00-guessing-game-tutorial.md index e3d0a119..f80ad520 100644 --- a/rustbook-en/src/ch02-00-guessing-game-tutorial.md +++ b/rustbook-en/src/ch02-00-guessing-game-tutorial.md @@ -654,8 +654,8 @@ elsewhere that would cause Rust to infer a different numerical type. The reason for the error is that Rust cannot compare a string and a number type. Ultimately, we want to convert the `String` the program reads as input into a -real number type so we can compare it numerically to the secret number. We do -so by adding this line to the `main` function body: +number type so we can compare it numerically to the secret number. We do so by +adding this line to the `main` function body: Filename: src/main.rs diff --git a/rustbook-en/src/ch03-05-control-flow.md b/rustbook-en/src/ch03-05-control-flow.md index 34b8372f..ac416660 100644 --- a/rustbook-en/src/ch03-05-control-flow.md +++ b/rustbook-en/src/ch03-05-control-flow.md @@ -250,6 +250,9 @@ and then check whether the `counter` is equal to `10`. When it is, we use the semicolon to end the statement that assigns the value to `result`. Finally, we print the value in `result`, which in this case is `20`. +You can also `return` from inside a loop. While `break` only exits the current +loop, `return` always exits the current function. + #### Loop Labels to Disambiguate Between Multiple Loops If you have loops within loops, `break` and `continue` apply to the innermost diff --git a/rustbook-en/src/ch04-03-slices.md b/rustbook-en/src/ch04-03-slices.md index c94fdc56..7f8c9b7a 100644 --- a/rustbook-en/src/ch04-03-slices.md +++ b/rustbook-en/src/ch04-03-slices.md @@ -1,8 +1,8 @@ ## The Slice Type -*Slices* let you reference a contiguous sequence of elements in a collection -rather than the whole collection. A slice is a kind of reference, so it does -not have ownership. +*Slices* let you reference a contiguous sequence of elements in a +[collection](ch08-00-common-collections.md) rather than the whole collection. A +slice is a kind of reference, so it does not have ownership. Here’s a small programming problem: write a function that takes a string of words separated by spaces and returns the first word it finds in that string. diff --git a/rustbook-en/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md b/rustbook-en/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md index 85fc2473..fa85082b 100644 --- a/rustbook-en/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md +++ b/rustbook-en/src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md @@ -150,7 +150,7 @@ and `fn add_to_waitlist` lets us call the function from `eat_at_restaurant` Now the code will compile! To see why adding the `pub` keyword lets us use -these paths in `add_to_waitlist` with respect to the privacy rules, let’s look +these paths in `eat_at_restaurant` with respect to the privacy rules, let’s look at the absolute and the relative paths. In the absolute path, we start with `crate`, the root of our crate’s module diff --git a/rustbook-en/src/ch09-02-recoverable-errors-with-result.md b/rustbook-en/src/ch09-02-recoverable-errors-with-result.md index 34c4e206..c6c4e4b9 100644 --- a/rustbook-en/src/ch09-02-recoverable-errors-with-result.md +++ b/rustbook-en/src/ch09-02-recoverable-errors-with-result.md @@ -147,10 +147,10 @@ the missing file error. > let greeting_file = File::open("hello.txt").unwrap_or_else(|error| { > if error.kind() == ErrorKind::NotFound { > File::create("hello.txt").unwrap_or_else(|error| { -> panic!("Problem creating the file: {:?}", error); +> panic!("Problem creating the file: {error:?}"); > }) > } else { -> panic!("Problem opening the file: {:?}", error); +> panic!("Problem opening the file: {error:?}"); > } > }); > } diff --git a/rustbook-en/src/ch11-01-writing-tests.md b/rustbook-en/src/ch11-01-writing-tests.md index aaac8e80..f1295931 100644 --- a/rustbook-en/src/ch11-01-writing-tests.md +++ b/rustbook-en/src/ch11-01-writing-tests.md @@ -497,10 +497,10 @@ This time when we run the `should_panic` test, it will fail: ``` The failure message indicates that this test did indeed panic as we expected, -but the panic message did not include the expected string `'Guess value must be -less than or equal to 100'`. The panic message that we did get in this case was -`Guess value must be greater than or equal to 1, got 200.` Now we can start -figuring out where our bug is! +but the panic message did not include the expected string `less than or equal +to 100`. The panic message that we did get in this case was `Guess value must +be greater than or equal to 1, got 200.` Now we can start figuring out where +our bug is! ### Using `Result` in Tests diff --git a/rustbook-en/src/ch11-03-test-organization.md b/rustbook-en/src/ch11-03-test-organization.md index 8aaa9e58..fb592e90 100644 --- a/rustbook-en/src/ch11-03-test-organization.md +++ b/rustbook-en/src/ch11-03-test-organization.md @@ -118,8 +118,9 @@ Enter the code in Listing 11-13 into the *tests/integration_test.rs* file: `adder` crate Each file in the `tests` directory is a separate crate, so we need to bring our -library into each test crate’s scope. For that reason we add `use adder` at the -top of the code, which we didn’t need in the unit tests. +library into each test crate’s scope. For that reason we add `use +adder::add_two` at the top of the code, which we didn’t need in the unit +tests. We don’t need to annotate any code in *tests/integration_test.rs* with `#[cfg(test)]`. Cargo treats the `tests` directory specially and compiles files diff --git a/rustbook-en/src/ch12-03-improving-error-handling-and-modularity.md b/rustbook-en/src/ch12-03-improving-error-handling-and-modularity.md index 87e525d1..1b67d63d 100644 --- a/rustbook-en/src/ch12-03-improving-error-handling-and-modularity.md +++ b/rustbook-en/src/ch12-03-improving-error-handling-and-modularity.md @@ -23,13 +23,13 @@ example, the file could be missing, or we might not have permission to open it. Right now, regardless of the situation, we’d print the same error message for everything, which wouldn’t give the user any information! -Fourth, we use `expect` repeatedly to handle different errors, and if the user -runs our program without specifying enough arguments, they’ll get an `index out -of bounds` error from Rust that doesn’t clearly explain the problem. It would -be best if all the error-handling code were in one place so future maintainers -had only one place to consult the code if the error-handling logic needed to -change. Having all the error-handling code in one place will also ensure that -we’re printing messages that will be meaningful to our end users. +Fourth, we use `expect` to handle an error, and if the user runs our program +without specifying enough arguments, they’ll get an `index out of bounds` error +from Rust that doesn’t clearly explain the problem. It would be best if all the +error-handling code were in one place so future maintainers had only one place +to consult the code if the error-handling logic needed to change. Having all the +error-handling code in one place will also ensure that we’re printing messages +that will be meaningful to our end users. Let’s address these four problems by refactoring our project. diff --git a/rustbook-en/src/ch13-01-closures.md b/rustbook-en/src/ch13-01-closures.md index d9e3ac68..a1e1cec8 100644 --- a/rustbook-en/src/ch13-01-closures.md +++ b/rustbook-en/src/ch13-01-closures.md @@ -329,8 +329,8 @@ Using `FnOnce` in the trait bound expresses the constraint that `unwrap_or_else` is only going to call `f` at most one time. In the body of `unwrap_or_else`, we can see that if the `Option` is `Some`, `f` won’t be called. If the `Option` is `None`, `f` will be called once. Because all -closures implement `FnOnce`, `unwrap_or_else` accepts the most different kinds -of closures and is as flexible as it can be. +closures implement `FnOnce`, `unwrap_or_else` accepts all three kinds of +closures and is as flexible as it can be. > Note: Functions can implement all three of the `Fn` traits too. If what we > want to do doesn’t require capturing a value from the environment, we can use diff --git a/rustbook-en/src/ch13-03-improving-our-io-project.md b/rustbook-en/src/ch13-03-improving-our-io-project.md index 42a5be89..e4deec56 100644 --- a/rustbook-en/src/ch13-03-improving-our-io-project.md +++ b/rustbook-en/src/ch13-03-improving-our-io-project.md @@ -90,7 +90,7 @@ We’ve updated the signature of the `Config::build` function so the parameter `args` has a generic type with the trait bounds `impl Iterator` instead of `&[String]`. This usage of the `impl Trait` syntax we discussed in the [“Traits as Parameters”][impl-trait] section of Chapter 10 -means that `args` can be any type that implements the `Iterator` type and +means that `args` can be any type that implements the `Iterator` trait and returns `String` items. Because we’re taking ownership of `args` and we’ll be mutating `args` by diff --git a/rustbook-en/src/ch14-02-publishing-to-crates-io.md b/rustbook-en/src/ch14-02-publishing-to-crates-io.md index c5b1ac7f..d4d33bab 100644 --- a/rustbook-en/src/ch14-02-publishing-to-crates-io.md +++ b/rustbook-en/src/ch14-02-publishing-to-crates-io.md @@ -273,10 +273,11 @@ in via a GitHub account. (The GitHub account is currently a requirement, but the site might support other ways of creating an account in the future.) Once you’re logged in, visit your account settings at [https://crates.io/me/](https://crates.io/me/) and retrieve your -API key. Then run the `cargo login` command with your API key, like this: +API key. Then run the `cargo login` command and paste your API key when prompted, like this: ```console -$ cargo login abcdefghijklmnopqrstuvwxyz012345 +$ cargo login +abcdefghijklmnopqrstuvwxyz012345 ``` This command will inform Cargo of your API token and store it locally in diff --git a/rustbook-en/src/ch14-03-cargo-workspaces.md b/rustbook-en/src/ch14-03-cargo-workspaces.md index 7c67331b..cbece823 100644 --- a/rustbook-en/src/ch14-03-cargo-workspaces.md +++ b/rustbook-en/src/ch14-03-cargo-workspaces.md @@ -267,10 +267,15 @@ error[E0432]: unresolved import `rand` To fix this, edit the *Cargo.toml* file for the `adder` package and indicate that `rand` is a dependency for it as well. Building the `adder` package will add `rand` to the list of dependencies for `adder` in *Cargo.lock*, but no -additional copies of `rand` will be downloaded. Cargo has ensured that every +additional copies of `rand` will be downloaded. Cargo will ensure that every crate in every package in the workspace using the `rand` package will be using -the same version, saving us space and ensuring that the crates in the workspace -will be compatible with each other. +the same version as long as they specify compatible versions of `rand`, saving +us space and ensuring that the crates in the workspace will be compatible with +each other. + +If crates in the workspace specify incompatible versions of the same dependency, +Cargo will resolve each of them, but will still try to resolve as few versions +as possible. #### Adding a Test to a Workspace diff --git a/rustbook-en/src/ch17-01-what-is-oo.md b/rustbook-en/src/ch17-01-what-is-oo.md index a47afebd..4a11b7cc 100644 --- a/rustbook-en/src/ch17-01-what-is-oo.md +++ b/rustbook-en/src/ch17-01-what-is-oo.md @@ -86,10 +86,10 @@ Because we’ve encapsulated the implementation details of the struct in the future. For instance, we could use a `HashSet` instead of a `Vec` for the `list` field. As long as the signatures of the `add`, `remove`, and `average` public methods stay the same, code using -`AveragedCollection` wouldn’t need to change. If we made `list` public instead, -this wouldn’t necessarily be the case: `HashSet` and `Vec` have -different methods for adding and removing items, so the external code would -likely have to change if it were modifying `list` directly. +`AveragedCollection` wouldn’t need to change in order to compile. If we made +`list` public instead, this wouldn’t necessarily be the case: `HashSet` and +`Vec` have different methods for adding and removing items, so the external +code would likely have to change if it were modifying `list` directly. If encapsulation is a required aspect for a language to be considered object-oriented, then Rust meets that requirement. The option to use `pub` or diff --git a/rustbook-en/src/ch18-02-refutability.md b/rustbook-en/src/ch18-02-refutability.md index 29ab7ec4..c8ca8b57 100644 --- a/rustbook-en/src/ch18-02-refutability.md +++ b/rustbook-en/src/ch18-02-refutability.md @@ -60,10 +60,10 @@ the code in the curly brackets, giving it a way to continue validly. Listing Listing 18-9: Using `if let` and a block with refutable patterns instead of `let` -We’ve given the code an out! This code is perfectly valid, although it means we -cannot use an irrefutable pattern without receiving a warning. If we give `if -let` a pattern that will always match, such as `x`, as shown in Listing 18-10, -the compiler will give a warning. +We’ve given the code an out! This code is perfectly valid now. However, +if we give `if let` an irrefutable pattern (a pattern that will always +match), such as `x`, as shown in Listing 18-10, the compiler will give a +warning. ```rust {{#rustdoc_include ../listings/ch18-patterns-and-matching/listing-18-10/src/main.rs:here}} diff --git a/rustbook-en/src/ch20-01-single-threaded.md b/rustbook-en/src/ch20-01-single-threaded.md index 993239a9..b980856f 100644 --- a/rustbook-en/src/ch20-01-single-threaded.md +++ b/rustbook-en/src/ch20-01-single-threaded.md @@ -448,7 +448,7 @@ uses the `status_line` and `filename` variables. This makes it easier to see the difference between the two cases, and it means we have only one place to update the code if we want to change how the file reading and response writing work. The behavior of the code in Listing 20-9 will be the same as that in -Listing 20-8. +Listing 20-7. Awesome! We now have a simple web server in approximately 40 lines of Rust code that responds to one request with a page of content and responds to all other diff --git a/rustbook-en/tools/doc-to-md.sh b/rustbook-en/tools/doc-to-md.sh index 8c802a71..26494600 100755 --- a/rustbook-en/tools/doc-to-md.sh +++ b/rustbook-en/tools/doc-to-md.sh @@ -22,7 +22,7 @@ directory, so all fixes need to be made in `/src/`. unzip -o "tmp/$filename.docx" -d "tmp/$filename" # Convert to markdown with XSL. xsltproc tools/docx-to-md.xsl "tmp/$filename/word/document.xml" | \ - # Hard wrap at 80 chars at word bourdaries. + # Hard wrap at 80 chars at word boundaries. fold -w 80 -s | \ # Remove trailing whitespace and append to the file in the `nostarch` dir for comparison. sed -e "s/ *$//" >> "nostarch/$filename.md" diff --git a/rustbook-en/tools/src/bin/convert_quotes.rs b/rustbook-en/tools/src/bin/convert_quotes.rs index b4a9bdce..a6a8dae7 100644 --- a/rustbook-en/tools/src/bin/convert_quotes.rs +++ b/rustbook-en/tools/src/bin/convert_quotes.rs @@ -8,7 +8,7 @@ fn main() { let mut buffer = String::new(); if let Err(e) = io::stdin().read_to_string(&mut buffer) { - panic!("{}", e); + panic!("{e}"); } for line in buffer.lines() { @@ -21,7 +21,7 @@ fn main() { if is_in_code_block { is_in_inline_code = false; is_in_html_tag = false; - println!("{}", line); + println!("{line}"); } else { let modified_line = &mut String::new(); let mut previous_char = std::char::REPLACEMENT_CHARACTER; @@ -72,7 +72,7 @@ fn main() { modified_line.push(char_to_push); previous_char = char_to_push; } - println!("{}", modified_line); + println!("{modified_line}"); } } } diff --git a/rustbook-en/tools/src/bin/lfp.rs b/rustbook-en/tools/src/bin/lfp.rs index c4d4bce0..f7b6e17f 100644 --- a/rustbook-en/tools/src/bin/lfp.rs +++ b/rustbook-en/tools/src/bin/lfp.rs @@ -18,7 +18,7 @@ fn main() { .map(|entry| match entry { Ok(entry) => entry, Err(err) => { - eprintln!("{:?}", err); + eprintln!("{err:?}"); std::process::exit(911) } }) diff --git a/rustbook-en/tools/src/bin/link2print.rs b/rustbook-en/tools/src/bin/link2print.rs index 1e92ecbc..7d6def86 100644 --- a/rustbook-en/tools/src/bin/link2print.rs +++ b/rustbook-en/tools/src/bin/link2print.rs @@ -14,12 +14,12 @@ fn read_md() -> String { let mut buffer = String::new(); match io::stdin().read_to_string(&mut buffer) { Ok(_) => buffer, - Err(error) => panic!("{}", error), + Err(error) => panic!("{error}"), } } fn write_md(output: String) { - print!("{}", output); + print!("{output}"); } fn parse_references(buffer: String) -> (String, HashMap) { @@ -71,17 +71,17 @@ fn parse_links((buffer, ref_map): (String, HashMap)) -> String { Some(key) => { match key.as_str() { // `[name][]` - "" => ref_map.get(&name.to_uppercase()).unwrap_or_else(|| panic!("could not find url for the link text `{}`", name)).to_string(), + "" => ref_map.get(&name.to_uppercase()).unwrap_or_else(|| panic!("could not find url for the link text `{name}`")).to_string(), // `[name][reference]` _ => ref_map.get(&key.as_str().to_uppercase()).unwrap_or_else(|| panic!("could not find url for the link text `{}`", key.as_str())).to_string(), } } // `[name]` as reference - None => ref_map.get(&name.to_uppercase()).unwrap_or_else(|| panic!("could not find url for the link text `{}`", name)).to_string(), + None => ref_map.get(&name.to_uppercase()).unwrap_or_else(|| panic!("could not find url for the link text `{name}`")).to_string(), } } }; - format!("{} at *{}*", name, val) + format!("{name} at *{val}*") } } }); diff --git a/rustbook-en/tools/src/bin/release_listings.rs b/rustbook-en/tools/src/bin/release_listings.rs index c371d7b3..4239a4da 100644 --- a/rustbook-en/tools/src/bin/release_listings.rs +++ b/rustbook-en/tools/src/bin/release_listings.rs @@ -149,7 +149,7 @@ fn copy_cleaned_rust_file( if !ANCHOR_OR_SNIP_COMMENTS.is_match(&line) && (item_name != "lib.rs" || !EMPTY_MAIN.is_match(&line)) { - writeln!(&mut to_buf, "{}", line)?; + writeln!(&mut to_buf, "{line}")?; } } diff --git a/rustbook-en/tools/src/bin/remove_hidden_lines.rs b/rustbook-en/tools/src/bin/remove_hidden_lines.rs index dc3c5935..934b64eb 100644 --- a/rustbook-en/tools/src/bin/remove_hidden_lines.rs +++ b/rustbook-en/tools/src/bin/remove_hidden_lines.rs @@ -9,12 +9,12 @@ fn read_md() -> String { let mut buffer = String::new(); match io::stdin().read_to_string(&mut buffer) { Ok(_) => buffer, - Err(error) => panic!("{}", error), + Err(error) => panic!("{error}"), } } fn write_md(output: String) { - print!("{}", output); + print!("{output}"); } fn remove_hidden_lines(input: &str) -> String { diff --git a/rustbook-en/tools/src/bin/remove_links.rs b/rustbook-en/tools/src/bin/remove_links.rs index b3f78d70..042295d1 100644 --- a/rustbook-en/tools/src/bin/remove_links.rs +++ b/rustbook-en/tools/src/bin/remove_links.rs @@ -8,7 +8,7 @@ use std::io::Read; fn main() { let mut buffer = String::new(); if let Err(e) = io::stdin().read_to_string(&mut buffer) { - panic!("{}", e); + panic!("{e}"); } let mut refs = HashSet::new(); @@ -41,5 +41,5 @@ fn main() { caps.get(0).unwrap().as_str().to_string() }); - print!("{}", out); + print!("{out}"); } diff --git a/rustbook-en/tools/src/bin/remove_markup.rs b/rustbook-en/tools/src/bin/remove_markup.rs index c42e588e..a9cc4b7f 100644 --- a/rustbook-en/tools/src/bin/remove_markup.rs +++ b/rustbook-en/tools/src/bin/remove_markup.rs @@ -12,12 +12,12 @@ fn read_md() -> String { let mut buffer = String::new(); match io::stdin().read_to_string(&mut buffer) { Ok(_) => buffer, - Err(error) => panic!("{}", error), + Err(error) => panic!("{error}"), } } fn write_md(output: String) { - print!("{}", output); + print!("{output}"); } fn remove_markup(input: String) -> String {