Skip to content

Commit aa0513f

Browse files
committed
fix formatting
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 439af32 commit aa0513f

File tree

8 files changed

+35
-44
lines changed

8 files changed

+35
-44
lines changed

src/hyperlight_host/benches/benchmarks.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ fn guest_call_benchmark(c: &mut Criterion) {
6363
.register("HostAdd", |a: i32, b: i32| Ok(a + b))
6464
.unwrap();
6565

66-
let mut multiuse_sandbox: MultiUseSandbox =
67-
uninitialized_sandbox.evolve().unwrap();
66+
let mut multiuse_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve().unwrap();
6867

6968
b.iter(|| {
7069
multiuse_sandbox

src/hyperlight_host/examples/guest-debugging/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ fn main() -> hyperlight_host::Result<()> {
6868
// Note: This function is unused, it's just here for demonstration purposes
6969

7070
// Initialize sandboxes to be able to call host functions
71-
let mut multi_use_sandbox_dbg: MultiUseSandbox =
72-
uninitialized_sandbox_dbg.evolve()?;
71+
let mut multi_use_sandbox_dbg: MultiUseSandbox = uninitialized_sandbox_dbg.evolve()?;
7372
let mut multi_use_sandbox: MultiUseSandbox = uninitialized_sandbox.evolve()?;
7473

7574
// Call guest function

src/hyperlight_host/examples/tracing-chrome/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ fn main() -> Result<()> {
3232
// Create a new sandbox.
3333
let usandbox = UninitializedSandbox::new(GuestBinary::FilePath(simple_guest_path), None)?;
3434

35-
let mut sbox = usandbox
36-
.evolve()
37-
.unwrap();
35+
let mut sbox = usandbox.evolve().unwrap();
3836

3937
// do the function call
4038
let current_time = std::time::Instant::now();

src/hyperlight_host/examples/tracing-tracy/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ fn main() -> Result<()> {
3838
// Create a new sandbox.
3939
let usandbox = UninitializedSandbox::new(GuestBinary::FilePath(simple_guest_path), None)?;
4040

41-
let mut sbox = usandbox
42-
.evolve()
43-
.unwrap();
41+
let mut sbox = usandbox.evolve().unwrap();
4442

4543
// do the function call
4644
let current_time = std::time::Instant::now();

src/hyperlight_host/src/sandbox/initialized_multi_use.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ impl MultiUseSandbox {
262262
}
263263

264264
impl Callable for MultiUseSandbox {
265-
fn call<Output: SupportedReturnType>(&mut self, func_name: &str, args: impl ParameterTuple) -> Result<Output> {
265+
fn call<Output: SupportedReturnType>(
266+
&mut self,
267+
func_name: &str,
268+
args: impl ParameterTuple,
269+
) -> Result<Output> {
266270
self.call_guest_function_by_name(func_name, args)
267271
}
268272
}
@@ -325,11 +329,12 @@ mod tests {
325329
.unwrap();
326330

327331
for i in 0..1000 {
328-
sbox2.call::<i32>(
329-
"PrintUsingPrintf",
330-
format!("Hello World {}\n", i).to_string(),
331-
)
332-
.unwrap();
332+
sbox2
333+
.call::<i32>(
334+
"PrintUsingPrintf",
335+
format!("Hello World {}\n", i).to_string(),
336+
)
337+
.unwrap();
333338
}
334339
}
335340

@@ -560,8 +565,7 @@ mod tests {
560565
)
561566
.unwrap();
562567

563-
let mut multi_use_sandbox: MultiUseSandbox =
564-
usbox.evolve().unwrap();
568+
let mut multi_use_sandbox: MultiUseSandbox = usbox.evolve().unwrap();
565569

566570
let res: i32 = multi_use_sandbox
567571
.call_guest_function_by_name("GetStatic", ())

src/hyperlight_host/src/sandbox/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,9 @@ mod tests {
164164
))
165165
.unwrap();
166166

167-
let sandbox = uninitialized_sandbox
168-
.evolve()
169-
.unwrap_or_else(|_| {
170-
panic!("Failed to initialize UninitializedSandbox thread {}", i)
171-
});
167+
let sandbox = uninitialized_sandbox.evolve().unwrap_or_else(|_| {
168+
panic!("Failed to initialize UninitializedSandbox thread {}", i)
169+
});
172170

173171
sq.push(sandbox).unwrap_or_else(|_| {
174172
panic!("Failed to push UninitializedSandbox thread {}", i)

src/hyperlight_host/src/sandbox/uninitialized.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,11 +806,9 @@ mod tests {
806806
.host_print(format!("Print from UninitializedSandbox on Thread {}\n", i))
807807
.unwrap();
808808

809-
let sandbox = uninitialized_sandbox
810-
.evolve()
811-
.unwrap_or_else(|_| {
812-
panic!("Failed to initialize UninitializedSandbox thread {}", i)
813-
});
809+
let sandbox = uninitialized_sandbox.evolve().unwrap_or_else(|_| {
810+
panic!("Failed to initialize UninitializedSandbox thread {}", i)
811+
});
814812

815813
sq.push(sandbox).unwrap_or_else(|_| {
816814
panic!("Failed to push UninitializedSandbox thread {}", i)

src/hyperlight_host/src/sandbox/uninitialized_evolve.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,20 @@ where
126126

127127
#[instrument(err(Debug), skip_all, parent = Span::current(), level = "Trace")]
128128
pub(super) fn evolve_impl_multi_use(u_sbox: UninitializedSandbox) -> Result<MultiUseSandbox> {
129-
evolve_impl(
130-
u_sbox,
131-
|hf, hshm, vm, out_hdl, mem_hdl, dispatch_ptr| {
129+
evolve_impl(u_sbox, |hf, hshm, vm, out_hdl, mem_hdl, dispatch_ptr| {
130+
#[cfg(gdb)]
131+
let dbg_mem_wrapper = dbg_mem_access_handler_wrapper(hshm.clone());
132+
Ok(MultiUseSandbox::from_uninit(
133+
hf,
134+
hshm,
135+
vm,
136+
out_hdl,
137+
mem_hdl,
138+
dispatch_ptr,
132139
#[cfg(gdb)]
133-
let dbg_mem_wrapper = dbg_mem_access_handler_wrapper(hshm.clone());
134-
Ok(MultiUseSandbox::from_uninit(
135-
hf,
136-
hshm,
137-
vm,
138-
out_hdl,
139-
mem_hdl,
140-
dispatch_ptr,
141-
#[cfg(gdb)]
142-
dbg_mem_wrapper,
143-
))
144-
},
145-
)
140+
dbg_mem_wrapper,
141+
))
142+
})
146143
}
147144

148145
pub(crate) fn set_up_hypervisor_partition(

0 commit comments

Comments
 (0)