From 166a005b7622c91d7a3ef154ffb9cf3f3ec0a873 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 21 Oct 2024 12:33:53 +0100 Subject: [PATCH] hypervisor: mshv: Fix superflous lifetimes warning: the following explicit lifetimes could be elided: 'a --> hypervisor/src/arch/x86/emulator/mod.rs:492:6 | 492 | impl<'a, T: CpuStateManager> Emulator<'a, T> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 492 - impl<'a, T: CpuStateManager> Emulator<'a, T> { 492 + impl Emulator<'_, T> { | warning: the following explicit lifetimes could be elided: 'a --> hypervisor/src/mshv/x86_64/emulator.rs:19:6 | 19 | impl<'a> MshvEmulatorContext<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 19 - impl<'a> MshvEmulatorContext<'a> { 19 + impl MshvEmulatorContext<'_> { | warning: the following explicit lifetimes could be elided: 'a --> hypervisor/src/mshv/x86_64/emulator.rs:65:6 | 65 | impl<'a> PlatformEmulator for MshvEmulatorContext<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 65 - impl<'a> PlatformEmulator for MshvEmulatorContext<'a> { 65 + impl PlatformEmulator for MshvEmulatorContext<'_> { | Signed-off-by: Rob Bradford --- hypervisor/src/arch/x86/emulator/mod.rs | 2 +- hypervisor/src/mshv/x86_64/emulator.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/src/arch/x86/emulator/mod.rs b/hypervisor/src/arch/x86/emulator/mod.rs index 5c71a7cf8..2e2f2e9fe 100644 --- a/hypervisor/src/arch/x86/emulator/mod.rs +++ b/hypervisor/src/arch/x86/emulator/mod.rs @@ -489,7 +489,7 @@ macro_rules! gen_handler_match { }; } -impl<'a, T: CpuStateManager> Emulator<'a, T> { +impl Emulator<'_, T> { pub fn new(platform: &mut dyn PlatformEmulator) -> Emulator { Emulator { platform } } diff --git a/hypervisor/src/mshv/x86_64/emulator.rs b/hypervisor/src/mshv/x86_64/emulator.rs index 6aa74f535..e6b0a83ca 100644 --- a/hypervisor/src/mshv/x86_64/emulator.rs +++ b/hypervisor/src/mshv/x86_64/emulator.rs @@ -16,7 +16,7 @@ pub struct MshvEmulatorContext<'a> { pub map: (u64, u64), // Initial GVA to GPA mapping provided by the hypervisor } -impl<'a> MshvEmulatorContext<'a> { +impl MshvEmulatorContext<'_> { // Do the actual gva -> gpa translation #[allow(non_upper_case_globals)] fn translate(&self, gva: u64, flags: u32) -> Result { @@ -62,7 +62,7 @@ impl<'a> MshvEmulatorContext<'a> { } /// Platform emulation for Hyper-V -impl<'a> PlatformEmulator for MshvEmulatorContext<'a> { +impl PlatformEmulator for MshvEmulatorContext<'_> { type CpuState = EmulatorCpuState; fn read_memory(&self, gva: u64, data: &mut [u8]) -> Result<(), PlatformError> {