block: keep lifetime consistent from input to output

Cargo fuzz build report an error:
error: lifetime flowing from input to output with different syntax can be confusing
   --> /home/runner/work/cloud-hypervisor/cloud-hypervisor/block/src/lib.rs:747:13
    |
747 |     fn file(&mut self) -> MutexGuard<F>;
    |             ^^^^^^^^^     ------------- the lifetime gets resolved as `'_`
    |             |
    |             this lifetime flows to the output

error: lifetime flowing from input to output with different syntax can be confusing
  --> /home/runner/work/cloud-hypervisor/cloud-hypervisor/block/src/async_io.rs:68:11
   |
68 |     fn fd(&mut self) -> BorrowedDiskFd;
   |           ^^^^^^^^^     -------------- the lifetime gets resolved as `'_`
   |           |
   |           this lifetime flows to the output

Signed-off-by: Yi Wang <foxywang@tencent.com>
This commit is contained in:
Yi Wang 2025-06-15 18:43:33 +08:00 committed by Jinank Jain
parent b26b09ec0c
commit 80f4bfac00
2 changed files with 2 additions and 2 deletions

View file

@ -65,7 +65,7 @@ pub trait DiskFile: Send {
///
/// The file descriptor is supposed to be used for `fcntl()` calls but no
/// other operation.
fn fd(&mut self) -> BorrowedDiskFd;
fn fd(&mut self) -> BorrowedDiskFd<'_>;
}
#[derive(Error, Debug)]

View file

@ -744,7 +744,7 @@ where
Ok(())
}
fn file(&mut self) -> MutexGuard<F>;
fn file(&mut self) -> MutexGuard<'_, F>;
}
pub enum ImageType {