diff --git a/src/bare-metal/aps/examples/src/main_minimal.rs b/src/bare-metal/aps/examples/src/main_minimal.rs index 56df0eda..e330db0f 100644 --- a/src/bare-metal/aps/examples/src/main_minimal.rs +++ b/src/bare-metal/aps/examples/src/main_minimal.rs @@ -35,7 +35,7 @@ extern "C" fn main(x0: u64, x1: u64, x2: u64, x3: u64) { // nothing else accesses that address range. let mut uart = unsafe { Uart::new(PL011_BASE_ADDRESS) }; - writeln!(uart, "main({:#x}, {:#x}, {:#x}, {:#x})", x0, x1, x2, x3).unwrap(); + writeln!(uart, "main({x0:#x}, {x1:#x}, {x2:#x}, {x3:#x})").unwrap(); system_off::().unwrap(); } diff --git a/src/concurrency/async-control-flow/join.md b/src/concurrency/async-control-flow/join.md index 6aa06e6d..4b064638 100644 --- a/src/concurrency/async-control-flow/join.md +++ b/src/concurrency/async-control-flow/join.md @@ -31,7 +31,7 @@ async fn main() { let results = future::join_all(futures_iter).await; let page_sizes_dict: HashMap<&str, Result> = urls.into_iter().zip(results.into_iter()).collect(); - println!("{:?}", page_sizes_dict); + println!("{page_sizes_dict:?}"); } ``` diff --git a/src/methods-and-traits/deriving.md b/src/methods-and-traits/deriving.md index c84496f2..1cc2bb6f 100644 --- a/src/methods-and-traits/deriving.md +++ b/src/methods-and-traits/deriving.md @@ -20,7 +20,7 @@ fn main() { let mut p2 = p1.clone(); // Clone trait adds `clone` method. p2.name = String::from("EldurScrollz"); // Debug trait adds support for printing with `{:?}`. - println!("{:?} vs. {:?}", p1, p2); + println!("{p1:?} vs. {p2:?}"); } ``` diff --git a/src/pattern-matching/exercise.rs b/src/pattern-matching/exercise.rs index 1dfb3f49..501b2236 100644 --- a/src/pattern-matching/exercise.rs +++ b/src/pattern-matching/exercise.rs @@ -130,6 +130,6 @@ fn main() { left: Box::new(Expression::Value(20)), right: Box::new(Expression::Value(10)), }; - println!("expr: {:?}", expr); + println!("expr: {expr:?}"); println!("result: {:?}", eval(expr)); } diff --git a/src/pattern-matching/let-control-flow.md b/src/pattern-matching/let-control-flow.md index f563239a..af2b1197 100644 --- a/src/pattern-matching/let-control-flow.md +++ b/src/pattern-matching/let-control-flow.md @@ -21,9 +21,9 @@ lets you execute different code depending on whether a value matches a pattern: use std::time::Duration; fn sleep_for(secs: f32) { - if let Ok(dur) = Duration::try_from_secs_f32(secs) { - std::thread::sleep(dur); - println!("slept for {:?}", dur); + if let Ok(duration) = Duration::try_from_secs_f32(secs) { + std::thread::sleep(duration); + println!("slept for {duration:?}"); } } diff --git a/src/std-traits/operators.md b/src/std-traits/operators.md index 9ab95908..9cd45acd 100644 --- a/src/std-traits/operators.md +++ b/src/std-traits/operators.md @@ -24,7 +24,7 @@ impl std::ops::Add for Point { fn main() { let p1 = Point { x: 10, y: 20 }; let p2 = Point { x: 100, y: 200 }; - println!("{:?} + {:?} = {:?}", p1, p2, p1 + p2); + println!("{p1:?} + {p2:?} = {:?}", p1 + p2); } ``` diff --git a/src/std-traits/read-and-write.md b/src/std-traits/read-and-write.md index 9a1add7c..c5de92fb 100644 --- a/src/std-traits/read-and-write.md +++ b/src/std-traits/read-and-write.md @@ -38,7 +38,7 @@ fn main() -> Result<()> { let mut buffer = Vec::new(); log(&mut buffer, "Hello")?; log(&mut buffer, "World")?; - println!("Logged: {:?}", buffer); + println!("Logged: {buffer:?}"); Ok(()) } ``` diff --git a/src/unsafe-rust/exercise.rs b/src/unsafe-rust/exercise.rs index 3cf870e9..96a251f2 100644 --- a/src/unsafe-rust/exercise.rs +++ b/src/unsafe-rust/exercise.rs @@ -91,7 +91,7 @@ impl DirectoryIterator { // SAFETY: path.as_ptr() cannot be NULL. let dir = unsafe { ffi::opendir(path.as_ptr()) }; if dir.is_null() { - Err(format!("Could not open {:?}", path)) + Err(format!("Could not open {path:?}")) } else { Ok(DirectoryIterator { path, dir }) } diff --git a/src/user-defined-types/enums.md b/src/user-defined-types/enums.md index dc34b80f..6ad356f9 100644 --- a/src/user-defined-types/enums.md +++ b/src/user-defined-types/enums.md @@ -22,8 +22,8 @@ enum PlayerMove { } fn main() { - let m: PlayerMove = PlayerMove::Run(Direction::Left); - println!("On this turn: {:?}", m); + let player_move: PlayerMove = PlayerMove::Run(Direction::Left); + println!("On this turn: {player_move:?}"); } ```