Skip to content

Commit 18f5a61

Browse files
test-runner: Fix clippy::uninlined_format_args lint
1 parent ca957ae commit 18f5a61

File tree

14 files changed

+33
-49
lines changed

14 files changed

+33
-49
lines changed

uefi-test-runner/examples/timestamp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ pub fn test_timestamp() {
5151
.expect("Founded Timestamp Protocol but open failed");
5252
// ANCHOR: text
5353
let timestamp = timestamp_proto.get_timestamp();
54-
info!("Timestamp Protocol's timestamp: {:?}", timestamp);
54+
info!("Timestamp Protocol's timestamp: {timestamp:?}");
5555

5656
let properties = timestamp_proto.get_properties();
57-
info!("Timestamp Protocol's properties: {:?}", properties);
57+
info!("Timestamp Protocol's properties: {properties:?}");
5858
// ANCHOR_END: text
5959
}
6060
Err(err) => {
61-
warn!("Failed to found Timestamp Protocol: {:?}", err);
61+
warn!("Failed to found Timestamp Protocol: {err}");
6262
}
6363
}
6464
}

uefi-test-runner/src/proto/ata/pass_thru.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn is_testdrive_present() -> bool {
4848
});
4949
let serial = core::str::from_utf8(&serial_bfr).unwrap().trim();
5050
if serial == "AtaPassThru" {
51-
info!("Found Testdisk at handle: {:?}", handle);
51+
info!("Found Testdisk at handle: {handle:?}");
5252
return true; // found our testdrive!
5353
}
5454
}

uefi-test-runner/src/proto/console/pointer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn test() {
1818
.expect("Failed to retrieve pointer state");
1919

2020
if let Some(state) = state {
21-
info!("New pointer State: {:#?}", state);
21+
info!("New pointer State: {state:#?}");
2222
} else {
2323
info!("Pointer state has not changed since the last query");
2424
}

uefi-test-runner/src/proto/console/stdout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn test(stdout: &mut Output) {
2828
// Retrieves and prints the current output mode.
2929
fn get_current_mode(stdout: &mut Output) {
3030
let current_mode = stdout.current_mode().unwrap();
31-
info!("UEFI standard output current mode: {:?}", current_mode);
31+
info!("UEFI standard output current mode: {current_mode:?}");
3232
}
3333

3434
// Switch to the maximum supported text mode.

uefi-test-runner/src/proto/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn test_debug_support() {
8686
);
8787

8888
info!("- Architecture: {:?}", debug_support.arch());
89-
info!("- Maximum Processor Index: {:?}", maximum_processor_index);
89+
info!("- Maximum Processor Index: {maximum_processor_index:?}");
9090

9191
match debug_support.arch() {
9292
// This arm is the only match when testing on QEMU w/ OVMF, regardless of the machine arch.

uefi-test-runner/src/proto/loaded_image.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ pub fn test() {
1010
.expect("Failed to open LoadedImage protocol");
1111

1212
let load_options = loaded_image.load_options_as_bytes();
13-
info!("LoadedImage options: {:?}", load_options);
13+
info!("LoadedImage options: {load_options:?}");
1414

1515
let (image_base, image_size) = loaded_image.info();
16-
info!(
17-
"LoadedImage image address: {:?}, image size: {} bytes",
18-
image_base, image_size
19-
);
16+
info!("LoadedImage image address: {image_base:?}, image size: {image_size} bytes");
2017
}

uefi-test-runner/src/proto/media.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn test_existing_file(directory: &mut Directory) {
124124
let mut buffer = vec![0; 128];
125125
let size = file.read(&mut buffer).expect("failed to read file");
126126
let buffer = &buffer[..size];
127-
info!("Successfully read {}", input_file_path);
127+
info!("Successfully read {input_file_path}");
128128
assert_eq!(buffer, b"test input data");
129129

130130
// Check file metadata.
@@ -370,7 +370,7 @@ fn test_disk_info() {
370370
let vendor_id = core::str::from_utf8(&inquiry_bfr[8..16]).unwrap().trim();
371371
let product_id = core::str::from_utf8(&inquiry_bfr[16..32]).unwrap().trim();
372372
if vendor_id == "uefi-rs" && product_id == "ExtScsiPassThru" {
373-
info!("Found Testdisk at Handle: {:?}", handle);
373+
info!("Found Testdisk at Handle: {handle:?}");
374374
found_drive = true;
375375
}
376376
}
@@ -385,7 +385,7 @@ fn test_partition_info(disk_handle: Handle) {
385385

386386
let mbr = pi.mbr_partition_record().expect("Not an MBR disk");
387387

388-
info!("MBR partition: {:?}", mbr);
388+
info!("MBR partition: {mbr:?}");
389389

390390
assert_eq!(mbr.boot_indicator, 0);
391391
assert_eq!({ mbr.starting_lba }, 1);

uefi-test-runner/src/proto/misc.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,14 @@ pub fn test_reset_notification() {
2525
data: *const u8,
2626
) {
2727
info!("Inside the event callback, hi, efi_reset_fn");
28-
info!("rt: {:?} status: {:?}", rt, status);
29-
info!("size: {:?} data: {:?}", data_size, data);
28+
info!("rt: {rt:?} status: {status:?}");
29+
info!("size: {data_size:?} data: {data:?}");
3030
// do what you want
3131
}
3232

3333
let result = reset_notif_proto.register_reset_notify(efi_reset_fn);
34-
info!(
35-
"ResetNotification Protocol register efi_reset_fn test: {:?}",
36-
result
37-
);
34+
info!("ResetNotification Protocol register efi_reset_fn test: {result:?}");
3835

3936
let result = reset_notif_proto.unregister_reset_notify(efi_reset_fn);
40-
info!(
41-
"ResetNotification Protocol unregister efi_reset_fn test: {:?}",
42-
result
43-
);
37+
info!("ResetNotification Protocol unregister efi_reset_fn test: {result:?}");
4438
}

uefi-test-runner/src/proto/network/http.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ use uefi_raw::protocol::network::http::HttpStatusCode;
1212

1313
pub fn print_handle_devpath(prefix: &str, handle: &Handle) {
1414
let Ok(dp) = boot::open_protocol_exclusive::<DevicePath>(*handle) else {
15-
info!("{}no device path for handle", prefix);
15+
info!("{prefix}no device path for handle");
1616
return;
1717
};
1818
if let Ok(string) = dp.to_string(DisplayOnly(true), AllowShortcuts(true)) {
19-
info!("{}{}", prefix, string);
19+
info!("{prefix}{string}");
2020
}
2121
}
2222

2323
fn fetch_http(handle: Handle, url: &str) -> Option<Vec<u8>> {
24-
info!("http: fetching {} ...", url);
24+
info!("http: fetching {url} ...");
2525

2626
let http_res = HttpHelper::new(handle);
2727
if let Err(e) = http_res {
28-
error!("http new: {}", e);
28+
error!("http new: {e}");
2929
return None;
3030
}
3131
let mut http = http_res.unwrap();
3232

3333
let res = http.configure();
3434
if let Err(e) = res {
35-
error!("http configure: {}", e);
35+
error!("http configure: {e}");
3636
return None;
3737
}
3838

3939
let res = http.request_get(url);
4040
if let Err(e) = res {
41-
error!("http request: {}", e);
41+
error!("http request: {e}");
4242
return None;
4343
}
4444

4545
let res = http.response_first(true);
4646
if let Err(e) = res {
47-
error!("http response: {}", e);
47+
error!("http response: {e}");
4848
return None;
4949
}
5050

@@ -64,7 +64,7 @@ fn fetch_http(handle: Handle, url: &str) -> Option<Vec<u8>> {
6464
error!("parse content length ({})", cl_hdr.1);
6565
return None;
6666
};
67-
info!("http: size is {} bytes", cl);
67+
info!("http: size is {cl} bytes");
6868

6969
let mut data = rsp.body;
7070
loop {
@@ -74,7 +74,7 @@ fn fetch_http(handle: Handle, url: &str) -> Option<Vec<u8>> {
7474

7575
let res = http.response_more();
7676
if let Err(e) = res {
77-
error!("read response: {}", e);
77+
error!("read response: {e}");
7878
return None;
7979
}
8080

uefi-test-runner/src/proto/network/snp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn receive(simple_network: &mut SimpleNetwork, buffer: &mut [u8]) -> uefi::Resul
7373
debug!("Received:");
7474
debug!(" src_mac = {:x?}", &recv_src_mac.0[0..6]);
7575
debug!(" dst_mac = {:x?}", &recv_dst_mac.0[0..6]);
76-
debug!(" ethernet_proto=0x{:x?}", recv_ethernet_protocol);
76+
debug!(" ethernet_proto=0x{recv_ethernet_protocol:x?}");
7777

7878
// Assert the ethernet frame was sent to the expected interface.
7979
{
@@ -239,7 +239,7 @@ pub fn test() {
239239
let res = simple_network.collect_statistics();
240240
match res {
241241
Ok(stats) => {
242-
info!("Stats: {:?}", stats);
242+
info!("Stats: {stats:?}");
243243

244244
// One frame should have been transmitted and one received
245245
assert_eq!(stats.tx_total_frames().unwrap(), 1);

uefi-test-runner/src/proto/nvme/pass_thru.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn has_nvme_drive() -> bool {
2929
let device_path_str = device_path
3030
.to_string(DisplayOnly(true), AllowShortcuts(false))
3131
.unwrap();
32-
info!("- Successfully opened NVMe: {}", device_path_str);
32+
info!("- Successfully opened NVMe: {device_path_str}");
3333
let mut nvme_ctrl = nvme_pt.controller();
3434

3535
let request = NvmeRequestBuilder::new(nvme_pt.io_align(), 0x06, NvmeQueueType::ADMIN)
@@ -42,7 +42,7 @@ fn has_nvme_drive() -> bool {
4242
if let Ok(result) = result {
4343
let bfr = result.transfer_buffer().unwrap();
4444
let serial = core::str::from_utf8(&bfr[4..24]).unwrap().trim();
45-
info!("Found NVMe with serial: '{}'", serial);
45+
info!("Found NVMe with serial: '{serial}'");
4646
if serial == "uefi-rsNvmePassThru" {
4747
return true;
4848
}

uefi-test-runner/src/proto/pci/root_bridge.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,7 @@ pub fn test() {
5555
}
5656

5757
log::info!(
58-
"PCI Device: [{}, {}, {}]: vendor={:04X}, device={:04X}, class={:02X}, subclass={:02X}",
59-
bus,
60-
dev,
61-
fun,
62-
vendor_id,
63-
device_id,
64-
class_code,
65-
subclass_code
58+
"PCI Device: [{bus}, {dev}, {fun}]: vendor={vendor_id:04X}, device={device_id:04X}, class={class_code:02X}, subclass={subclass_code:02X}"
6659
);
6760
}
6861
}

uefi-test-runner/src/proto/rng.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ pub fn test() {
1414
let mut list = [RngAlgorithmType::EMPTY_ALGORITHM; 4];
1515

1616
let list = rng.get_info(&mut list).unwrap();
17-
info!("Supported rng algorithms : {:?}", list);
17+
info!("Supported rng algorithms : {list:?}");
1818

1919
let mut buf = [0u8; 4];
2020

2121
rng.get_rng(Some(list[0]), &mut buf).unwrap();
2222

2323
assert_ne!([0u8; 4], buf);
24-
info!("Random buffer : {:?}", buf);
24+
info!("Random buffer : {buf:?}");
2525
}

uefi-test-runner/src/runtime/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ fn test_time() {
3434

3535
// Print the new time and check that the year was successfully changed.
3636
let now = runtime::get_time().unwrap();
37-
info!("After setting time: {}", now);
37+
info!("After setting time: {now}");
3838
assert_eq!(now.year(), 2020);
3939
}

0 commit comments

Comments
 (0)