Skip to content

Commit f8986db

Browse files
committed
Changes for new lints/issues in Rust v1.89
Signed-off-by: Simon Davies <[email protected]>
1 parent 54e27fd commit f8986db

File tree

14 files changed

+46
-49
lines changed

14 files changed

+46
-49
lines changed

src/hyperlight_common/src/clippy.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ disallowed-macros = [
22
{ path = "std::assert", reason = "no asserts in release builds" },
33
{ path = "std::assert_eq", reason = "no asserts in release builds" },
44
{ path = "std::assert_ne", reason = "no asserts in release builds" },
5-
{ path = "std::assert_true", reason = "no asserts in release builds" },
6-
{ path = "std::assert_false", reason = "no asserts in release builds" },
75
]

src/hyperlight_common/src/flatbuffers/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @generated
33
pub mod hyperlight {
44
use super::*;
5+
#[allow(mismatched_lifetime_syntaxes)]
56
pub mod generated {
67
use super::*;
78
mod parameter_value_generated;

src/hyperlight_component_util/src/emit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ impl<'a> WitName<'a> {
680680
}
681681
}
682682
/// Parse a kebab-name as a WIT name
683-
pub fn split_wit_name(n: &str) -> WitName {
683+
pub fn split_wit_name(n: &str) -> WitName<'_> {
684684
let mut namespaces = Vec::new();
685685
let mut colon_components = n.split(':').rev();
686686
let last = colon_components.next().unwrap();

src/hyperlight_guest_tracing_macro/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ impl syn::parse::Parse for TraceMacroInput {
113113
if !matches!(message, syn::Lit::Str(_)) {
114114
return Err(input.error("first argument to trace! must be a string literal"));
115115
}
116-
if let syn::Lit::Str(ref lit_str) = message {
117-
if lit_str.value().is_empty() {
118-
return Err(input.error("trace message must not be empty"));
119-
}
116+
if let syn::Lit::Str(ref lit_str) = message
117+
&& lit_str.value().is_empty()
118+
{
119+
return Err(input.error("trace message must not be empty"));
120120
}
121121

122122
let statement = if input.peek(syn::Token![,]) {

src/hyperlight_host/clippy.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ disallowed-macros = [
22
{ path = "std::assert", reason = "no asserts in release builds" },
33
{ path = "std::assert_eq", reason = "no asserts in release builds" },
44
{ path = "std::assert_ne", reason = "no asserts in release builds" },
5-
{ path = "std::assert_true", reason = "no asserts in release builds" },
6-
{ path = "std::assert_false", reason = "no asserts in release builds" },
75
]

src/hyperlight_host/src/hypervisor/gdb/x86_64_target.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,18 @@ impl Target for HyperlightSandboxTarget {
133133
type Arch = GdbTargetArch;
134134
type Error = GdbTargetError;
135135

136-
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<Self>> {
136+
fn support_breakpoints(&mut self) -> Option<BreakpointsOps<'_, Self>> {
137137
Some(self)
138138
}
139139

140140
#[inline(always)]
141-
fn base_ops(&mut self) -> BaseOps<Self::Arch, Self::Error> {
141+
fn base_ops(&mut self) -> BaseOps<'_, Self::Arch, Self::Error> {
142142
BaseOps::SingleThread(self)
143143
}
144144

145145
fn support_section_offsets(
146146
&mut self,
147-
) -> Option<gdbstub::target::ext::section_offsets::SectionOffsetsOps<Self>> {
147+
) -> Option<gdbstub::target::ext::section_offsets::SectionOffsetsOps<'_, Self>> {
148148
Some(self)
149149
}
150150
}
@@ -288,7 +288,7 @@ impl SingleThreadBase for HyperlightSandboxTarget {
288288
}
289289
}
290290

291-
fn support_resume(&mut self) -> Option<SingleThreadResumeOps<Self>> {
291+
fn support_resume(&mut self) -> Option<SingleThreadResumeOps<'_, Self>> {
292292
Some(self)
293293
}
294294
}
@@ -315,7 +315,7 @@ impl SectionOffsets for HyperlightSandboxTarget {
315315
}
316316

317317
impl Breakpoints for HyperlightSandboxTarget {
318-
fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<Self>> {
318+
fn support_hw_breakpoint(&mut self) -> Option<HwBreakpointOps<'_, Self>> {
319319
Some(self)
320320
}
321321
fn support_sw_breakpoint(&mut self) -> Option<SwBreakpointOps<'_, Self>> {
@@ -438,7 +438,7 @@ impl SingleThreadResume for HyperlightSandboxTarget {
438438
log::debug!("Resume");
439439
self.resume_vcpu()
440440
}
441-
fn support_single_step(&mut self) -> Option<SingleThreadSingleStepOps<Self>> {
441+
fn support_single_step(&mut self) -> Option<SingleThreadSingleStepOps<'_, Self>> {
442442
Some(self)
443443
}
444444
}

src/hyperlight_host/src/hypervisor/hyperv_linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ impl Hypervisor for HypervLinuxDriver {
961961
}
962962

963963
#[cfg(crashdump)]
964-
fn crashdump_context(&self) -> Result<Option<super::crashdump::CrashDumpContext>> {
964+
fn crashdump_context(&self) -> Result<Option<super::crashdump::CrashDumpContext<'_>>> {
965965
if self.rt_cfg.guest_core_dump {
966966
let mut regs = [0; 27];
967967

src/hyperlight_host/src/hypervisor/kvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ impl Hypervisor for KVMDriver {
832832
}
833833

834834
#[cfg(crashdump)]
835-
fn crashdump_context(&self) -> Result<Option<crashdump::CrashDumpContext>> {
835+
fn crashdump_context(&self) -> Result<Option<crashdump::CrashDumpContext<'_>>> {
836836
if self.rt_cfg.guest_core_dump {
837837
let mut regs = [0; 27];
838838

src/hyperlight_host/src/hypervisor/mod.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub(crate) trait Hypervisor: Debug + Send {
230230
fn as_mut_hypervisor(&mut self) -> &mut dyn Hypervisor;
231231

232232
#[cfg(crashdump)]
233-
fn crashdump_context(&self) -> Result<Option<crashdump::CrashDumpContext>>;
233+
fn crashdump_context(&self) -> Result<Option<crashdump::CrashDumpContext<'_>>>;
234234

235235
#[cfg(gdb)]
236236
/// handles the cases when the vCPU stops due to a Debug event
@@ -267,16 +267,15 @@ pub(crate) fn get_memory_access_violation<'a>(
267267
// find the region containing the given gpa
268268
let region = mem_regions.find(|region| region.guest_region.contains(&gpa));
269269

270-
if let Some(region) = region {
271-
if !region.flags.contains(access_info)
272-
|| region.flags.contains(MemoryRegionFlags::STACK_GUARD)
273-
{
274-
return Some(HyperlightExit::AccessViolation(
275-
gpa as u64,
276-
access_info,
277-
region.flags,
278-
));
279-
}
270+
if let Some(region) = region
271+
&& (!region.flags.contains(access_info)
272+
|| region.flags.contains(MemoryRegionFlags::STACK_GUARD))
273+
{
274+
return Some(HyperlightExit::AccessViolation(
275+
gpa as u64,
276+
access_info,
277+
region.flags,
278+
));
280279
}
281280
None
282281
}

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,11 @@ where
223223
let addr = (p << 21) + (i << 12);
224224

225225
// First check if we're still in the cached region
226-
if let Some(cached_idx) = *cached_region_idx {
227-
if cached_idx < regions.len() && regions[cached_idx].guest_region.contains(&addr) {
228-
return Ok(regions[cached_idx].region_type);
229-
}
226+
if let Some(cached_idx) = *cached_region_idx
227+
&& cached_idx < regions.len()
228+
&& regions[cached_idx].guest_region.contains(&addr)
229+
{
230+
return Ok(regions[cached_idx].region_type);
230231
}
231232

232233
// If not in cached region, try adjacent regions first (common for sequential access)

0 commit comments

Comments
 (0)