Skip to content

Commit 9a2860a

Browse files
committed
Fix clippy warnings that are enabled in newer toolchains
Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent cf6f842 commit 9a2860a

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

src/hyperlight_component_util/src/subtype.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum Error<'r> {
3636
/// A value type was present, but incompatible with its expected type
3737
MismatchedValue(Value<'r>, Value<'r>),
3838
/// A defined type was present, but incompatible with its expected type
39-
MismatchedDefined(Defined<'r>, Defined<'r>),
39+
MismatchedDefined(Box<Defined<'r>>, Box<Defined<'r>>),
4040
/// A resource was present, but was not the same resource as was expected
4141
MismatchedResources(ResourceId, ResourceId),
4242
/// A type variable could not be resolved to be the same as the
@@ -239,7 +239,10 @@ impl<'p, 'a> Ctx<'p, 'a> {
239239
self.subtype_qualified_instance(it1, it2)
240240
}
241241
(Defined::Component(ct1), Defined::Component(ct2)) => self.subtype_component(ct1, ct2),
242-
_ => Err(Error::MismatchedDefined(dt1.clone(), dt2.clone())),
242+
_ => Err(Error::MismatchedDefined(
243+
Box::new(dt1.clone()),
244+
Box::new(dt2.clone()),
245+
)),
243246
}
244247
}
245248
pub fn subtype_handleable_is_resource<'r>(&self, ht: &'r Handleable) -> Result<(), Error<'a>> {

src/hyperlight_host/src/hypervisor/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ pub trait InterruptHandle: Debug + Send + Sync {
373373
///
374374
/// - If this is called while the vcpu is running, then it will interrupt the vcpu and return `true`.
375375
/// - If this is called while the vcpu is not running, (for example during a host call), the
376-
/// vcpu will not immediately be interrupted, but will prevent the vcpu from running **the next time**
377-
/// it's scheduled, and returns `false`.
376+
/// vcpu will not immediately be interrupted, but will prevent the vcpu from running **the next time**
377+
/// it's scheduled, and returns `false`.
378378
///
379379
/// # Note
380380
/// This function will block for the duration of the time it takes for the vcpu thread to be interrupted.
@@ -384,8 +384,8 @@ pub trait InterruptHandle: Debug + Send + Sync {
384384
///
385385
/// - If this is called while the vcpu is running, then it will interrupt the vcpu and return `true`.
386386
/// - If this is called while the vcpu is not running, (for example during a host call), the
387-
/// vcpu will not immediately be interrupted, but will prevent the vcpu from running **the next time**
388-
/// it's scheduled, and returns `false`.
387+
/// vcpu will not immediately be interrupted, but will prevent the vcpu from running **the next time**
388+
/// it's scheduled, and returns `false`.
389389
///
390390
/// # Note
391391
/// This function will block for the duration of the time it takes for the vcpu thread to be interrupted.
@@ -407,7 +407,7 @@ pub(super) struct LinuxInterruptHandle {
407407
/// 1. The VCPU is running (generation N),
408408
/// 2. It gets cancelled,
409409
/// 3. Then quickly restarted (generation N+1),
410-
/// before the original thread has observed that it was cancelled.
410+
/// before the original thread has observed that it was cancelled.
411411
///
412412
/// Without this generation counter, the interrupt logic might assume the VCPU is still
413413
/// in the *original* run (generation N), see that it's `running`, and re-send the signal.
@@ -423,9 +423,9 @@ pub(super) struct LinuxInterruptHandle {
423423
/// `kill()` is called, and cleared when the vcpu is no longer running.
424424
/// This is used to
425425
/// 1. make sure stale signals do not interrupt the
426-
/// the wrong vcpu (a vcpu may only be interrupted iff `cancel_requested` is true),
426+
/// the wrong vcpu (a vcpu may only be interrupted iff `cancel_requested` is true),
427427
/// 2. ensure that if a vm is killed while a host call is running,
428-
/// the vm will not re-enter the guest after the host call returns.
428+
/// the vm will not re-enter the guest after the host call returns.
429429
cancel_requested: AtomicBool,
430430
/// True when the debugger has requested the VM to be interrupted. Set immediately when
431431
/// `kill_from_debugger()` is called, and cleared when the vcpu is no longer running.

src/hyperlight_host/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub mod hypervisor;
5050
/// present and code length will be zero;
5151
///
5252
/// - The pointer passed to the Entrypoint in the Guest application is the size of page table + size of code,
53-
/// at this address structs below are laid out in this order
53+
/// at this address structs below are laid out in this order
5454
pub mod mem;
5555
/// Metric definitions and helpers
5656
pub mod metrics;

src/hyperlight_host/src/mem/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use crate::{Result, new_error};
6464
// +-------------------------------------------+ 0x0_000
6565

6666
/// - `InitData` - some extra data that can be loaded onto the sandbox during
67-
/// initialization.
67+
/// initialization.
6868
///
6969
/// - `HostDefinitions` - the length of this is the `HostFunctionDefinitionSize`
7070
/// field from `SandboxConfiguration`

src/hyperlight_host/src/mem/shared_mem.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ impl HostSharedMemory {
785785
/// patterns
786786
pub fn read<T: AllValid>(&self, offset: usize) -> Result<T> {
787787
bounds_check!(offset, std::mem::size_of::<T>(), self.mem_size());
788-
let ret = unsafe {
788+
unsafe {
789789
let mut ret: core::mem::MaybeUninit<T> = core::mem::MaybeUninit::uninit();
790790
{
791791
let slice: &mut [u8] = core::slice::from_raw_parts_mut(
@@ -795,8 +795,7 @@ impl HostSharedMemory {
795795
self.copy_to_slice(slice, offset)?;
796796
}
797797
Ok(ret.assume_init())
798-
};
799-
ret
798+
}
800799
}
801800

802801
/// Write a value of type T, whose representation is the same

0 commit comments

Comments
 (0)