Skip to content

Commit 123780b

Browse files
committed
fmt
1 parent 5ec2ed7 commit 123780b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

modules/axdriver/src/dyn_drivers/blk/virtio.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ fn probe(info: FdtInfo<'_>, plat_dev: PlatformDevice) -> Result<(), OnProbeError
5252

5353
let dev = Device::try_new(transport).map_err(|e| {
5454
OnProbeError::other(format!(
55-
"failed to initialize Virtio Block device at [PA:{:?},): {:?}",
56-
mmio_base, e
55+
"failed to initialize Virtio Block device at [PA:{mmio_base:?},): {e:?}"
5756
))
5857
})?;
5958

modules/axdriver/src/dyn_drivers/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core::{error::Error, ops::Deref, ptr::NonNull};
22

3-
use alloc::{boxed::Box, format};
3+
use alloc::{boxed::Box, format, string::ToString};
44
use axerrno::{AxError, AxResult};
55
use axhal::mem::{MemoryAddr, PhysAddr, VirtAddr, phys_to_virt};
66
use lazyinit::LazyInit;
@@ -41,15 +41,14 @@ fn iomap(addr: PhysAddr, size: usize) -> Result<NonNull<u8>, Box<dyn Error>> {
4141
let size = end - start;
4242
let iomap = *IO_MAP_FUNC
4343
.get()
44-
.ok_or_else(|| format!("IO map function not initialized"))?;
44+
.ok_or_else(|| "IO map function not initialized".to_string())?;
4545

4646
let virt = match iomap(start, size) {
4747
Ok(val) => val,
4848
Err(AxError::AlreadyExists) => phys_to_virt(start),
4949
Err(e) => {
5050
return Err(format!(
51-
"Failed to map MMIO region: {:?} (addr: {:?}, size: {:#x})",
52-
e, start, size
51+
"Failed to map MMIO region: {e:?} (addr: {start:?}, size: {size:#x})"
5352
)
5453
.into());
5554
}

0 commit comments

Comments
 (0)