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

@@ -74,10 +74,10 @@ impl DeviceTree {
pub fn remove(&mut self, k: &str) -> Option<DeviceNode> {
self.0.remove(k)
}
pub fn iter(&self) -> std::collections::hash_map::Iter<String, DeviceNode> {
pub fn iter(&self) -> std::collections::hash_map::Iter<'_, String, DeviceNode> {
self.0.iter()
}
pub fn breadth_first_traversal(&self) -> BftIter {
pub fn breadth_first_traversal(&self) -> BftIter<'_> {
BftIter::new(&self.0)
}
pub fn pci_devices(&self) -> Vec<&DeviceNode> {

View File

@@ -184,12 +184,12 @@ impl Target for GdbStub {
type Error = String;
#[inline(always)]
fn base_ops(&mut self) -> BaseOps<Self::Arch, Self::Error> {
fn base_ops(&mut self) -> BaseOps<'_, Self::Arch, Self::Error> {
BaseOps::MultiThread(self)
}
#[inline(always)]
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<Self>> {
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<'_, Self>> {
Some(self)
}
@@ -388,7 +388,7 @@ impl MultiThreadSingleStep for GdbStub {
impl Breakpoints for GdbStub {
#[inline(always)]
fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<Self>> {
fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<'_, Self>> {
Some(self)
}
}