diff --git a/listings/ch09-error-handling/listing-09-13/src/main.rs b/listings/ch09-error-handling/listing-09-13/src/main.rs index 9e07c1ee25..42b7d32ef6 100644 --- a/listings/ch09-error-handling/listing-09-13/src/main.rs +++ b/listings/ch09-error-handling/listing-09-13/src/main.rs @@ -10,7 +10,7 @@ pub struct Guess { impl Guess { pub fn new(value: i32) -> Guess { if value < 1 || value > 100 { - panic!("Guess value must be between 1 and 100, got {}.", value); + panic!("Guess value must be between 1 and 100, got {value}."); } Guess { value } diff --git a/listings/ch11-writing-automated-tests/listing-11-08/src/lib.rs b/listings/ch11-writing-automated-tests/listing-11-08/src/lib.rs index 9391be5b1f..54e447bb93 100644 --- a/listings/ch11-writing-automated-tests/listing-11-08/src/lib.rs +++ b/listings/ch11-writing-automated-tests/listing-11-08/src/lib.rs @@ -5,7 +5,7 @@ pub struct Guess { impl Guess { pub fn new(value: i32) -> Guess { if value < 1 || value > 100 { - panic!("Guess value must be between 1 and 100, got {}.", value); + panic!("Guess value must be between 1 and 100, got {value}."); } Guess { value } diff --git a/listings/ch11-writing-automated-tests/listing-11-09/src/lib.rs b/listings/ch11-writing-automated-tests/listing-11-09/src/lib.rs index cc1c5c35d0..1bb464137b 100644 --- a/listings/ch11-writing-automated-tests/listing-11-09/src/lib.rs +++ b/listings/ch11-writing-automated-tests/listing-11-09/src/lib.rs @@ -9,13 +9,11 @@ impl Guess { pub fn new(value: i32) -> Guess { if value < 1 { panic!( - "Guess value must be greater than or equal to 1, got {}.", - value + "Guess value must be greater than or equal to 1, got {value}." ); } else if value > 100 { panic!( - "Guess value must be less than or equal to 100, got {}.", - value + "Guess value must be less than or equal to 100, got {value}." ); } diff --git a/listings/ch11-writing-automated-tests/no-listing-08-guess-with-bug/src/lib.rs b/listings/ch11-writing-automated-tests/no-listing-08-guess-with-bug/src/lib.rs index 32540ba83c..0f962fcd79 100644 --- a/listings/ch11-writing-automated-tests/no-listing-08-guess-with-bug/src/lib.rs +++ b/listings/ch11-writing-automated-tests/no-listing-08-guess-with-bug/src/lib.rs @@ -7,7 +7,7 @@ pub struct Guess { impl Guess { pub fn new(value: i32) -> Guess { if value < 1 { - panic!("Guess value must be between 1 and 100, got {}.", value); + panic!("Guess value must be between 1 and 100, got {value}."); } Guess { value } diff --git a/listings/ch11-writing-automated-tests/no-listing-09-guess-with-panic-msg-bug/src/lib.rs b/listings/ch11-writing-automated-tests/no-listing-09-guess-with-panic-msg-bug/src/lib.rs index 7703dd75ae..fb5fc0e77b 100644 --- a/listings/ch11-writing-automated-tests/no-listing-09-guess-with-panic-msg-bug/src/lib.rs +++ b/listings/ch11-writing-automated-tests/no-listing-09-guess-with-panic-msg-bug/src/lib.rs @@ -7,13 +7,11 @@ impl Guess { // ANCHOR: here if value < 1 { panic!( - "Guess value must be less than or equal to 100, got {}.", - value + "Guess value must be less than or equal to 100, got {value}." ); } else if value > 100 { panic!( - "Guess value must be greater than or equal to 1, got {}.", - value + "Guess value must be greater than or equal to 1, got {value}." ); } // ANCHOR_END: here