You've already forked comprehensive-rust
							
							
				mirror of
				https://github.com/google/comprehensive-rust.git
				synced 2025-10-31 08:37:45 +02:00 
			
		
		
		
	Consistently inline formatting arguments (#2413)
This commit is contained in:
		| @@ -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::<Hvc>().unwrap(); | ||||
| } | ||||
|   | ||||
| @@ -31,7 +31,7 @@ async fn main() { | ||||
|     let results = future::join_all(futures_iter).await; | ||||
|     let page_sizes_dict: HashMap<&str, Result<usize>> = | ||||
|         urls.into_iter().zip(results.into_iter()).collect(); | ||||
|     println!("{:?}", page_sizes_dict); | ||||
|     println!("{page_sizes_dict:?}"); | ||||
| } | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -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:?}"); | ||||
| } | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -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)); | ||||
| } | ||||
|   | ||||
| @@ -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:?}"); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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); | ||||
| } | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -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(()) | ||||
| } | ||||
| ``` | ||||
|   | ||||
| @@ -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 }) | ||||
|         } | ||||
|   | ||||
| @@ -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:?}"); | ||||
| } | ||||
| ``` | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user