misc: Fix missing lifetime syntax clippy warning

This was caught by the nightly compiler during cargo fuzz build.

error: lifetime flowing from input to output with different syntax can be confusing
   --> /home/runner/work/cloud-hypervisor/cloud-hypervisor/hypervisor/src/arch/x86/emulator/mod.rs:493:26
    |
493 |     pub fn new(platform: &mut dyn PlatformEmulator<CpuState = T>) -> Emulator<T> {
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     ----------- the lifetime gets resolved as `'_`
    |                          |
    |                          this lifetime flows to the output
    |
    = note: `-D mismatched-lifetime-syntaxes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(mismatched_lifetime_syntaxes)]`
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
493 |     pub fn new(platform: &mut dyn PlatformEmulator<CpuState = T>) -> Emulator<'_, T> {

Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
Jinank Jain
2025-06-09 15:23:59 +05:30
committed by Rob Bradford
parent 51002f2bae
commit 2bc8d51a60
12 changed files with 17 additions and 17 deletions

View File

@@ -34,7 +34,7 @@ impl DiskFile for FixedVhdDiskAsync {
) as Box<dyn AsyncIo>)
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.0.as_raw_fd())
}
}

View File

@@ -34,7 +34,7 @@ impl DiskFile for FixedVhdDiskSync {
) as Box<dyn AsyncIo>)
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.0.as_raw_fd())
}
}

View File

@@ -111,7 +111,7 @@ impl<T: Cacheable> CacheMap<T> {
self.map.get_mut(&index)
}
pub fn iter_mut(&mut self) -> IterMut<usize, T> {
pub fn iter_mut(&mut self) -> IterMut<'_, usize, T> {
self.map.iter_mut()
}

View File

@@ -39,7 +39,7 @@ impl DiskFile for QcowDiskSync {
Ok(Box::new(QcowSync::new(self.qcow_file.clone())) as Box<dyn AsyncIo>)
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
let lock = self.qcow_file.lock().unwrap();
BorrowedDiskFd::new(lock.as_raw_fd())
}
@@ -63,7 +63,7 @@ impl QcowSync {
}
impl AsyncAdaptor<QcowFile> for Arc<Mutex<QcowFile>> {
fn file(&mut self) -> MutexGuard<QcowFile> {
fn file(&mut self) -> MutexGuard<'_, QcowFile> {
self.lock().unwrap()
}
}

View File

@@ -47,7 +47,7 @@ impl DiskFile for RawFileDisk {
}
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.file.as_raw_fd())
}
}

View File

@@ -50,7 +50,7 @@ impl DiskFile for RawFileDiskAio {
}
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.file.as_raw_fd())
}
}

View File

@@ -44,7 +44,7 @@ impl DiskFile for RawFileDiskSync {
}
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
BorrowedDiskFd::new(self.file.as_raw_fd())
}
}

View File

@@ -39,7 +39,7 @@ impl DiskFile for VhdxDiskSync {
)
}
fn fd(&mut self) -> BorrowedDiskFd {
fn fd(&mut self) -> BorrowedDiskFd<'_> {
let lock = self.vhdx_file.lock().unwrap();
BorrowedDiskFd::new(lock.as_raw_fd())
}
@@ -62,7 +62,7 @@ impl VhdxSync {
}
impl AsyncAdaptor<Vhdx> for Arc<Mutex<Vhdx>> {
fn file(&mut self) -> MutexGuard<Vhdx> {
fn file(&mut self) -> MutexGuard<'_, Vhdx> {
self.lock().unwrap()
}
}