1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-27 19:18:59 +02:00

Inline format vars to make the format str simpler (#551)

This commit is contained in:
Yuri Astrakhan
2023-04-06 06:00:10 -04:00
committed by GitHub
parent 86d8c4ae54
commit 5cdb73387f
5 changed files with 9 additions and 10 deletions

View File

@ -52,7 +52,7 @@ extern "C" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {
// and nothing else accesses that address range.
let rtc = unsafe { Rtc::new(PL031_BASE_ADDRESS) };
let time = Utc.timestamp_opt(rtc.read().into(), 0).unwrap();
info!("RTC: {}", time);
info!("RTC: {time}");
// ANCHOR: main_end
system_off().unwrap();
@ -60,7 +60,7 @@ extern "C" fn main(x0: u64, x1: u64, x2: u64, x3: u64) {
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
error!("{}", info);
error!("{info}");
system_off().unwrap();
loop {}
}

View File

@ -42,8 +42,7 @@ pub fn luhn(cc_number: &str) -> bool {
fn main() {
let cc_number = "1234 5678 1234 5670";
println!(
"Is {} a valid credit card number? {}",
cc_number,
"Is {cc_number} a valid credit card number? {}",
if luhn(cc_number) { "yes" } else { "no" }
);
}