mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Use variables directly in format! string
Fix clippy warning `uninlined_format_args` reported by rustc rustc
1.89.0 (29483883e 2025-08-04).
```console
warning: variables can be used directly in the `format!` string
--> block/src/lib.rs:649:17
|
649 | info!("{} failed to create io_uring instance: {}", error_msg, e);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `#[warn(clippy::uninlined_format_args)]` on by default
help: change this to
|
649 - info!("{} failed to create io_uring instance: {}", error_msg, e);
649 + info!("{error_msg} failed to create io_uring instance: {e}");
|
```
Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
committed by
cloud-hypervisor-bot
parent
ea83fe314c
commit
f2dfa7f6e0
@@ -51,7 +51,7 @@ impl BusDevice for AcpiShutdownDevice {
|
||||
if data[0] == 1 {
|
||||
info!("ACPI Reboot signalled");
|
||||
if let Err(e) = self.reset_evt.write(1) {
|
||||
error!("Error triggering ACPI reset event: {}", e);
|
||||
error!("Error triggering ACPI reset event: {e}");
|
||||
}
|
||||
// Spin until we are sure the reset_evt has been handled and that when
|
||||
// we return from the KVM_RUN we will exit rather than re-enter the guest.
|
||||
@@ -68,7 +68,7 @@ impl BusDevice for AcpiShutdownDevice {
|
||||
if data[0] == (S5_SLEEP_VALUE << SLEEP_VALUE_BIT) | (1 << SLEEP_STATUS_EN_BIT) {
|
||||
info!("ACPI Shutdown signalled");
|
||||
if let Err(e) = self.exit_evt.write(1) {
|
||||
error!("Error triggering ACPI shutdown event: {}", e);
|
||||
error!("Error triggering ACPI shutdown event: {e}");
|
||||
}
|
||||
// Spin until we are sure the reset_evt has been handled and that when
|
||||
// we return from the KVM_RUN we will exit rather than re-enter the guest.
|
||||
|
||||
@@ -151,13 +151,13 @@ impl BusDevice for Ioapic {
|
||||
return;
|
||||
}
|
||||
|
||||
debug!("IOAPIC_R @ offset 0x{:x}", offset);
|
||||
debug!("IOAPIC_R @ offset 0x{offset:x}");
|
||||
|
||||
let value: u32 = match offset as u8 {
|
||||
IOREGSEL_OFF => self.reg_sel,
|
||||
IOWIN_OFF => self.ioapic_read(),
|
||||
_ => {
|
||||
error!("IOAPIC: failed reading at offset {}", offset);
|
||||
error!("IOAPIC: failed reading at offset {offset}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -171,7 +171,7 @@ impl BusDevice for Ioapic {
|
||||
return None;
|
||||
}
|
||||
|
||||
debug!("IOAPIC_W @ offset 0x{:x}", offset);
|
||||
debug!("IOAPIC_W @ offset 0x{offset:x}");
|
||||
|
||||
let value = LittleEndian::read_u32(data);
|
||||
|
||||
@@ -179,7 +179,7 @@ impl BusDevice for Ioapic {
|
||||
IOREGSEL_OFF => self.reg_sel = value,
|
||||
IOWIN_OFF => self.ioapic_write(value),
|
||||
_ => {
|
||||
error!("IOAPIC: failed writing at offset {}", offset);
|
||||
error!("IOAPIC: failed writing at offset {offset}");
|
||||
}
|
||||
}
|
||||
None
|
||||
@@ -266,7 +266,7 @@ impl Ioapic {
|
||||
IOWIN_OFF..=REG_MAX_OFFSET => {
|
||||
let (index, is_high_bits) = decode_irq_from_selector(self.reg_sel as u8);
|
||||
if index > NUM_IOAPIC_PINS {
|
||||
warn!("IOAPIC index out of range: {}", index);
|
||||
warn!("IOAPIC index out of range: {index}");
|
||||
return;
|
||||
}
|
||||
if is_high_bits {
|
||||
@@ -282,7 +282,7 @@ impl Ioapic {
|
||||
// The entry must be updated through the interrupt source
|
||||
// group.
|
||||
if let Err(e) = self.update_entry(index, true) {
|
||||
error!("Failed updating IOAPIC entry: {:?}", e);
|
||||
error!("Failed updating IOAPIC entry: {e:?}");
|
||||
}
|
||||
// Store the information this IRQ is now being used.
|
||||
self.used_entries[index] = true;
|
||||
@@ -303,7 +303,7 @@ impl Ioapic {
|
||||
IOWIN_OFF..=REG_MAX_OFFSET => {
|
||||
let (index, is_high_bits) = decode_irq_from_selector(self.reg_sel as u8);
|
||||
if index > NUM_IOAPIC_PINS {
|
||||
warn!("IOAPIC index out of range: {}", index);
|
||||
warn!("IOAPIC index out of range: {index}");
|
||||
return 0;
|
||||
}
|
||||
if is_high_bits {
|
||||
|
||||
@@ -90,7 +90,7 @@ impl BusDevice for Cmos {
|
||||
self.data[(self.index & INDEX_MASK) as usize] = data[0]
|
||||
}
|
||||
}
|
||||
o => warn!("bad write offset on CMOS device: {}", o),
|
||||
o => warn!("bad write offset on CMOS device: {o}"),
|
||||
};
|
||||
None
|
||||
}
|
||||
@@ -164,7 +164,7 @@ impl BusDevice for Cmos {
|
||||
}
|
||||
}
|
||||
o => {
|
||||
warn!("bad read offset on CMOS device: {}", o);
|
||||
warn!("bad read offset on CMOS device: {o}");
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ impl BusDevice for I8042Device {
|
||||
if data.len() == 1 && data[0] == 0xfe && offset == 3 {
|
||||
info!("i8042 reset signalled");
|
||||
if let Err(e) = self.reset_evt.write(1) {
|
||||
error!("Error triggering i8042 reset event: {}", e);
|
||||
error!("Error triggering i8042 reset event: {e}");
|
||||
}
|
||||
// Spin until we are sure the reset_evt has been handled and that when
|
||||
// we return from the KVM_RUN we will exit rather than re-enter the guest.
|
||||
|
||||
@@ -68,8 +68,7 @@ impl PvPanicDevice {
|
||||
let pci_configuration_state =
|
||||
vm_migration::state_from_id(snapshot.as_ref(), PCI_CONFIGURATION_ID).map_err(|e| {
|
||||
PvPanicError::RetrievePciConfigurationState(anyhow!(
|
||||
"Failed to get PciConfigurationState from Snapshot: {}",
|
||||
e
|
||||
"Failed to get PciConfigurationState from Snapshot: {e}"
|
||||
))
|
||||
})?;
|
||||
|
||||
@@ -100,8 +99,7 @@ impl PvPanicDevice {
|
||||
.transpose()
|
||||
.map_err(|e| {
|
||||
PvPanicError::CreatePvPanicDevice(anyhow!(
|
||||
"Failed to get PvPanicDeviceState from Snapshot: {}",
|
||||
e
|
||||
"Failed to get PvPanicDeviceState from Snapshot: {e}"
|
||||
))
|
||||
})?;
|
||||
let events = if let Some(state) = state {
|
||||
@@ -148,7 +146,7 @@ impl BusDevice for PvPanicDevice {
|
||||
|
||||
fn write(&mut self, _base: u64, _offset: u64, data: &[u8]) -> Option<Arc<Barrier>> {
|
||||
let event = self.event_to_string(data[0]);
|
||||
info!("pvpanic got guest event {}", event);
|
||||
info!("pvpanic got guest event {event}");
|
||||
event!("guest", "panic", "event", &event);
|
||||
None
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ pub struct Tpm {
|
||||
impl Tpm {
|
||||
pub fn new(path: String) -> Result<Self> {
|
||||
let emulator = Emulator::new(path)
|
||||
.map_err(|e| Error::Init(anyhow!("Failed while initializing tpm Emulator: {:?}", e)))?;
|
||||
.map_err(|e| Error::Init(anyhow!("Failed while initializing tpm Emulator: {e:?}")))?;
|
||||
let mut tpm = Tpm {
|
||||
emulator,
|
||||
regs: [0; TPM_CRB_R_MAX],
|
||||
@@ -331,8 +331,7 @@ impl Tpm {
|
||||
|
||||
if let Err(e) = self.emulator.startup_tpm(self.backend_buff_size) {
|
||||
return Err(Error::Init(anyhow!(
|
||||
"Failed while running Startup TPM. Error: {:?}",
|
||||
e
|
||||
"Failed while running Startup TPM. Error: {e:?}"
|
||||
)));
|
||||
}
|
||||
Ok(())
|
||||
@@ -460,7 +459,7 @@ impl BusDevice for Tpm {
|
||||
&& (self.regs[CRB_CTRL_START as usize] & CRB_START_INVOKE != 0)
|
||||
&& let Err(e) = self.emulator.cancel_cmd()
|
||||
{
|
||||
error!("Failed to run cancel command. Error: {:?}", e);
|
||||
error!("Failed to run cancel command. Error: {e:?}");
|
||||
}
|
||||
}
|
||||
CRB_CTRL_START => {
|
||||
@@ -481,10 +480,7 @@ impl BusDevice for Tpm {
|
||||
}
|
||||
}
|
||||
CRB_LOC_CTRL => {
|
||||
warn!(
|
||||
"CRB_LOC_CTRL locality to write = {:?} val = {:?}",
|
||||
locality, v
|
||||
);
|
||||
warn!("CRB_LOC_CTRL locality to write = {locality:?} val = {v:?}");
|
||||
match v {
|
||||
CRB_LOC_CTRL_RESET_ESTABLISHMENT_BIT => {}
|
||||
CRB_LOC_CTRL_RELINQUISH => {
|
||||
@@ -517,7 +513,7 @@ impl BusDevice for Tpm {
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
error!("Invalid value to write in CRB_LOC_CTRL {:#X} ", v);
|
||||
error!("Invalid value to write in CRB_LOC_CTRL {v:#X} ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user