misc: Automatically fix cargo clippy issues added in 1.65 (stable)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2022-12-14 11:41:15 +00:00
parent 8b59316718
commit 5e52729453
57 changed files with 448 additions and 574 deletions

View File

@@ -517,7 +517,7 @@ pub fn create_pty() -> io::Result<(File, File, PathBuf)> {
return vmm_sys_util::errno::errno_result().map_err(|e| e.into());
}
let proc_path = PathBuf::from(format!("/proc/self/fd/{}", sub_fd));
let proc_path = PathBuf::from(format!("/proc/self/fd/{sub_fd}"));
let path = read_link(proc_path)?;
// SAFETY: sub_fd is checked to be valid before being wrapped in File
@@ -665,15 +665,14 @@ impl DeviceRelocation for AddressManager {
return Err(io::Error::new(
io::ErrorKind::Other,
format!(
"Couldn't find a resource with base 0x{:x} for device {}",
old_base, id
"Couldn't find a resource with base 0x{old_base:x} for device {id}"
),
));
}
} else {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("Couldn't find device {} from device tree", id),
format!("Couldn't find device {id} from device tree"),
));
}
}
@@ -687,7 +686,7 @@ impl DeviceRelocation for AddressManager {
self.vm.unregister_ioevent(event, &io_addr).map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("failed to unregister ioevent: {:?}", e),
format!("failed to unregister ioevent: {e:?}"),
)
})?;
}
@@ -698,7 +697,7 @@ impl DeviceRelocation for AddressManager {
.map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("failed to register ioevent: {:?}", e),
format!("failed to register ioevent: {e:?}"),
)
})?;
}
@@ -719,7 +718,7 @@ impl DeviceRelocation for AddressManager {
self.vm.remove_user_memory_region(mem_region).map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("failed to remove user memory region: {:?}", e),
format!("failed to remove user memory region: {e:?}"),
)
})?;
@@ -736,7 +735,7 @@ impl DeviceRelocation for AddressManager {
self.vm.create_user_memory_region(mem_region).map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("failed to create user memory regions: {:?}", e),
format!("failed to create user memory regions: {e:?}"),
)
})?;
@@ -745,7 +744,7 @@ impl DeviceRelocation for AddressManager {
virtio_dev.set_shm_regions(shm_regions).map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("failed to update shared memory regions: {:?}", e),
format!("failed to update shared memory regions: {e:?}"),
)
})?;
}
@@ -3435,7 +3434,7 @@ impl DeviceManager {
pci_segment_id: u16,
dma_handler: Option<Arc<dyn ExternalDmaMapping>>,
) -> DeviceManagerResult<PciBdf> {
let id = format!("{}-{}", VIRTIO_PCI_DEVICE_NAME_PREFIX, virtio_device_id);
let id = format!("{VIRTIO_PCI_DEVICE_NAME_PREFIX}-{virtio_device_id}");
// Add the new virtio-pci node to the device tree.
let mut node = device_node!(id);
@@ -4237,7 +4236,7 @@ impl Aml for DeviceManager {
let mut pci_scan_methods = Vec::new();
for i in 0..self.pci_segments.len() {
pci_scan_methods.push(aml::MethodCall::new(
format!("\\_SB_.PCI{:X}.PCNT", i).as_str().into(),
format!("\\_SB_.PCI{i:X}.PCNT").as_str().into(),
vec![],
));
}