Skip to content

Commit 9009bcd

Browse files
committed
Clippy fixes for updates to Rust Version 2024
Signed-off-by: Simon Davies <[email protected]>
1 parent 83d8ead commit 9009bcd

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/hyperlight_common/src/flatbuffer_wrappers/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub trait FlatbufferSerializable {
4545
fn serialize(&self, builder: &mut FlatBufferBuilder) -> FbFunctionCallResultArgs;
4646
}
4747

48-
/// Implementations for basic types below
48+
// Implementations for basic types below
4949

5050
impl FlatbufferSerializable for () {
5151
fn serialize(&self, builder: &mut FlatBufferBuilder) -> FbFunctionCallResultArgs {

src/hyperlight_host/src/mem/layout.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ impl SandboxMemoryLayout {
462462

463463
// Get the number of pages needed for the PTs
464464

465-
let num_pages: usize = ((total_mapped_memory_size + AMOUNT_OF_MEMORY_PER_PT - 1)
466-
/ AMOUNT_OF_MEMORY_PER_PT)
465+
let num_pages: usize = total_mapped_memory_size.div_ceil(AMOUNT_OF_MEMORY_PER_PT)
467466
+ 3; // PML4, PDPT, PD
468467

469468
num_pages * PAGE_SIZE_USIZE

src/hyperlight_host/src/mem/mgr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ where
145145

146146
let mem_size = usize::try_from(mem_size)?;
147147

148-
let num_pages: usize =
149-
(mem_size + AMOUNT_OF_MEMORY_PER_PT - 1) / AMOUNT_OF_MEMORY_PER_PT;
148+
let num_pages: usize = mem_size.div_ceil(AMOUNT_OF_MEMORY_PER_PT);
150149

151150
// Create num_pages PT with 512 PTEs
152151
for p in 0..num_pages {

src/hyperlight_host/src/metrics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
assert!(
153153
matches!(
154154
histogram_value,
155-
metrics_util::debugging::DebugValue::Histogram(ref histogram) if histogram.len() == 1
155+
metrics_util::debugging::DebugValue::Histogram(histogram) if histogram.len() == 1
156156
),
157157
"Histogram metric does not match expected value"
158158
);
@@ -169,7 +169,7 @@ mod tests {
169169
assert!(
170170
matches!(
171171
histogram_value,
172-
metrics_util::debugging::DebugValue::Histogram(ref histogram) if histogram.len() == 1
172+
metrics_util::debugging::DebugValue::Histogram(histogram) if histogram.len() == 1
173173
),
174174
"Histogram metric does not match expected value"
175175
);
@@ -196,7 +196,7 @@ mod tests {
196196
assert!(
197197
matches!(
198198
histogram_value,
199-
metrics_util::debugging::DebugValue::Histogram(ref histogram) if histogram.len() == 1
199+
metrics_util::debugging::DebugValue::Histogram(histogram) if histogram.len() == 1
200200
),
201201
"Histogram metric does not match expected value"
202202
);

src/hyperlight_host/src/sandbox_state/transition.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl<Cur: Sandbox, Next: Sandbox> TransitionMetadata<Cur, Next> for Noop<Cur, Ne
100100
/// };
101101
/// let mutating_cb = MultiUseContextCallback::from(my_cb_fn);
102102
/// ```
103-
104103
pub struct MultiUseContextCallback<'func, Cur: Sandbox, F>
105104
where
106105
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()> + 'func,
@@ -110,14 +109,14 @@ where
110109
cb: F,
111110
}
112111

113-
impl<'a, Cur: Sandbox, Next: Sandbox, F> TransitionMetadata<Cur, Next>
114-
for MultiUseContextCallback<'a, Cur, F>
112+
impl<Cur: Sandbox, Next: Sandbox, F> TransitionMetadata<Cur, Next>
113+
for MultiUseContextCallback<'_, Cur, F>
115114
where
116115
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()>,
117116
{
118117
}
119118

120-
impl<'a, Cur: Sandbox, F> MultiUseContextCallback<'a, Cur, F>
119+
impl<Cur: Sandbox, F> MultiUseContextCallback<'_, Cur, F>
121120
where
122121
F: FnOnce(&mut MultiUseGuestCallContext) -> Result<()>,
123122
{

0 commit comments

Comments
 (0)