Skip to content

Set fmt style-edition to 2024 #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/host_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
use hyperlight_host::sandbox_state::transition::Noop;
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
use hyperlight_testing::simple_guest_for_fuzzing_as_string;
use libfuzzer_sys::{fuzz_target, Corpus};
use libfuzzer_sys::{Corpus, fuzz_target};

static SANDBOX: OnceLock<Mutex<MultiUseSandbox>> = OnceLock::new();

Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ group_imports = "StdExternalCrate" # create three groups for std, external and l
# Merge imports from the same module
# See: https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#imports_granularity
imports_granularity = "Module"
style_edition = "2021"
style_edition = "2024"
14 changes: 7 additions & 7 deletions src/hyperlight_common/src/flatbuffer_wrappers/function_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ limitations under the License.
use alloc::string::{String, ToString};
use alloc::vec::Vec;

use anyhow::{bail, Error, Result};
use flatbuffers::{size_prefixed_root, WIPOffset};
use anyhow::{Error, Result, bail};
use flatbuffers::{WIPOffset, size_prefixed_root};
#[cfg(feature = "tracing")]
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use super::function_types::{ParameterValue, ReturnType};
use crate::flatbuffers::hyperlight::generated::{
hlbool, hlboolArgs, hldouble, hldoubleArgs, hlfloat, hlfloatArgs, hlint, hlintArgs, hllong,
hllongArgs, hlstring, hlstringArgs, hluint, hluintArgs, hlulong, hlulongArgs, hlvecbytes,
hlvecbytesArgs, FunctionCall as FbFunctionCall, FunctionCallArgs as FbFunctionCallArgs,
FunctionCall as FbFunctionCall, FunctionCallArgs as FbFunctionCallArgs,
FunctionCallType as FbFunctionCallType, Parameter, ParameterArgs,
ParameterValue as FbParameterValue,
ParameterValue as FbParameterValue, hlbool, hlboolArgs, hldouble, hldoubleArgs, hlfloat,
hlfloatArgs, hlint, hlintArgs, hllong, hllongArgs, hlstring, hlstringArgs, hluint, hluintArgs,
hlulong, hlulongArgs, hlvecbytes, hlvecbytesArgs,
};

/// The type of function call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ limitations under the License.
use alloc::string::{String, ToString};
use alloc::vec::Vec;

use anyhow::{anyhow, bail, Error, Result};
use anyhow::{Error, Result, anyhow, bail};
use flatbuffers::size_prefixed_root;
#[cfg(feature = "tracing")]
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use crate::flatbuffers::hyperlight::generated::{
hlbool, hlboolArgs, hldouble, hldoubleArgs, hlfloat, hlfloatArgs, hlint, hlintArgs, hllong,
hllongArgs, hlsizeprefixedbuffer, hlsizeprefixedbufferArgs, hlstring, hlstringArgs, hluint,
hluintArgs, hlulong, hlulongArgs, hlvoid, hlvoidArgs,
FunctionCallResult as FbFunctionCallResult, FunctionCallResultArgs as FbFunctionCallResultArgs,
Parameter, ParameterType as FbParameterType, ParameterValue as FbParameterValue,
ReturnType as FbReturnType, ReturnValue as FbReturnValue,
ReturnType as FbReturnType, ReturnValue as FbReturnValue, hlbool, hlboolArgs, hldouble,
hldoubleArgs, hlfloat, hlfloatArgs, hlint, hlintArgs, hllong, hllongArgs, hlsizeprefixedbuffer,
hlsizeprefixedbufferArgs, hlstring, hlstringArgs, hluint, hluintArgs, hlulong, hlulongArgs,
hlvoid, hlvoidArgs,
};

/// Supported parameter types with values for function calling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use alloc::vec::Vec;
use anyhow::{Error, Result};
use flatbuffers::size_prefixed_root;
#[cfg(feature = "tracing")]
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use crate::flatbuffers::hyperlight::generated::{
ErrorCode as FbErrorCode, GuestError as FbGuestError, GuestErrorArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
use alloc::string::{String, ToString};
use alloc::vec::Vec;

use anyhow::{anyhow, Error, Result};
use anyhow::{Error, Result, anyhow};
use flatbuffers::size_prefixed_root;
#[cfg(feature = "tracing")]
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use super::guest_log_level::LogLevel;
use crate::flatbuffers::hyperlight::generated::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

use anyhow::{bail, Error, Result};
use anyhow::{Error, Result, bail};
use log::Level;
#[cfg(feature = "tracing")]
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use crate::flatbuffers::hyperlight::generated::LogLevel as FbLogLevel;

Expand Down
12 changes: 6 additions & 6 deletions src/hyperlight_common/src/flatbuffer_wrappers/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ use alloc::vec::Vec;
use flatbuffers::FlatBufferBuilder;

use crate::flatbuffers::hyperlight::generated::{
hlbool as Fbhlbool, hlboolArgs as FbhlboolArgs, hldouble as Fbhldouble,
hldoubleArgs as FbhldoubleArgs, hlfloat as Fbhlfloat, hlfloatArgs as FbhlfloatArgs,
hlint as Fbhlint, hlintArgs as FbhlintArgs, hllong as Fbhllong, hllongArgs as FbhllongArgs,
hlsizeprefixedbuffer as Fbhlsizeprefixedbuffer,
FunctionCallResult as FbFunctionCallResult, FunctionCallResultArgs as FbFunctionCallResultArgs,
ReturnValue as FbReturnValue, hlbool as Fbhlbool, hlboolArgs as FbhlboolArgs,
hldouble as Fbhldouble, hldoubleArgs as FbhldoubleArgs, hlfloat as Fbhlfloat,
hlfloatArgs as FbhlfloatArgs, hlint as Fbhlint, hlintArgs as FbhlintArgs, hllong as Fbhllong,
hllongArgs as FbhllongArgs, hlsizeprefixedbuffer as Fbhlsizeprefixedbuffer,
hlsizeprefixedbufferArgs as FbhlsizeprefixedbufferArgs, hlstring as Fbhlstring,
hlstringArgs as FbhlstringArgs, hluint as Fbhluint, hluintArgs as FbhluintArgs,
hlulong as Fbhlulong, hlulongArgs as FbhlulongArgs, hlvoid as Fbhlvoid,
hlvoidArgs as FbhlvoidArgs, FunctionCallResult as FbFunctionCallResult,
FunctionCallResultArgs as FbFunctionCallResultArgs, ReturnValue as FbReturnValue,
hlvoidArgs as FbhlvoidArgs,
};

/// Flatbuffer-encodes the given value
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_common/src/outb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

use core::convert::TryFrom;

use anyhow::{anyhow, Error};
use anyhow::{Error, anyhow};

/// Exception codes for the x86 architecture.
/// These are helpful to identify the type of exception that occurred
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest/src/exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

use core::arch::asm;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};

use hyperlight_common::outb::OutBAction;

Expand Down
6 changes: 3 additions & 3 deletions src/hyperlight_guest_bin/src/exceptions/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ limitations under the License.
use hyperlight_common::outb::Exception;

use crate::exceptions::interrupt_entry::{
_do_excp0, _do_excp1, _do_excp10, _do_excp11, _do_excp12, _do_excp13, _do_excp14, _do_excp15,
_do_excp16, _do_excp17, _do_excp18, _do_excp19, _do_excp2, _do_excp20, _do_excp3, _do_excp30,
_do_excp4, _do_excp5, _do_excp6, _do_excp7, _do_excp8, _do_excp9,
_do_excp0, _do_excp1, _do_excp2, _do_excp3, _do_excp4, _do_excp5, _do_excp6, _do_excp7,
_do_excp8, _do_excp9, _do_excp10, _do_excp11, _do_excp12, _do_excp13, _do_excp14, _do_excp15,
_do_excp16, _do_excp17, _do_excp18, _do_excp19, _do_excp20, _do_excp30,
};

// An entry in the Interrupt Descriptor Table (IDT)
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_bin/src/exceptions/idtr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
use core::mem::size_of;
use core::ptr::addr_of;

use crate::exceptions::idt::{init_idt, IdtEntry, IDT};
use crate::exceptions::idt::{IDT, IdtEntry, init_idt};

#[repr(C, packed)]
pub struct Idtr {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_bin/src/guest_err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};

use hyperlight_common::flatbuffer_wrappers::guest_error::ErrorCode;
use hyperlight_guest::exit::halt;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_bin/src/host_comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};
use core::mem;

use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_capi/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
use alloc::boxed::Box;
use alloc::slice;
use alloc::vec::Vec;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};
use core::mem;

use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_capi/src/flatbuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

use alloc::boxed::Box;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};

use hyperlight_common::flatbuffer_wrappers::util::get_flatbuffer_result;
use hyperlight_guest_bin::host_comm::get_host_return_value;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_capi/src/types/function_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use alloc::ffi::CString;
use alloc::slice;
use alloc::string::String;
use alloc::vec::Vec;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};

use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall;
use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterValue, ReturnType};
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_guest_capi/src/types/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

use alloc::ffi::CString;
use core::ffi::{c_char, CStr};
use core::ffi::{CStr, c_char};

use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterType, ParameterValue};
use hyperlight_guest::error::Result;
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use hyperlight_host::GuestBinary;
use hyperlight_host::sandbox::{MultiUseSandbox, SandboxConfiguration, UninitializedSandbox};
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
use hyperlight_host::sandbox_state::transition::Noop;
use hyperlight_host::GuestBinary;
use hyperlight_testing::simple_guest_as_string;

fn create_uninit_sandbox() -> UninitializedSandbox {
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/examples/guest-debugging/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ limitations under the License.
#![allow(clippy::disallowed_macros)]
use std::thread;

use hyperlight_host::sandbox::SandboxConfiguration;
#[cfg(gdb)]
use hyperlight_host::sandbox::config::DebugInfo;
use hyperlight_host::sandbox::SandboxConfiguration;
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
use hyperlight_host::sandbox_state::transition::Noop;
use hyperlight_host::{MultiUseSandbox, UninitializedSandbox};
Expand Down Expand Up @@ -79,7 +79,7 @@ mod tests {
use std::process::{Command, Stdio};
use std::time::Duration;

use hyperlight_host::{new_error, Result};
use hyperlight_host::{Result, new_error};
use io::{BufReader, BufWriter, Read, Write};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/examples/metrics/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
#![allow(clippy::disallowed_macros)]
extern crate hyperlight_host;
use std::sync::{Arc, Barrier};
use std::thread::{spawn, JoinHandle};
use std::thread::{JoinHandle, spawn};

use hyperlight_host::sandbox::uninitialized::UninitializedSandbox;
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
Expand Down
6 changes: 3 additions & 3 deletions src/hyperlight_host/examples/tracing-otlp/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ limitations under the License.
#![allow(clippy::disallowed_macros)]
//use opentelemetry_sdk::resource::ResourceBuilder;
use opentelemetry_sdk::trace::SdkTracerProvider;
use tracing::{span, Level};
use tracing::{Level, span};
use tracing_opentelemetry::OpenTelemetryLayer;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
extern crate hyperlight_host;
use std::error::Error;
use std::io::stdin;
use std::sync::{Arc, Barrier, Mutex};
use std::thread::{spawn, JoinHandle};
use std::thread::{JoinHandle, spawn};

use hyperlight_host::sandbox::uninitialized::UninitializedSandbox;
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
use hyperlight_host::sandbox_state::transition::Noop;
use hyperlight_host::{GuestBinary, MultiUseSandbox, Result as HyperlightResult};
use hyperlight_testing::simple_guest_as_string;
use opentelemetry::trace::TracerProvider;
use opentelemetry::{global, KeyValue};
use opentelemetry::{KeyValue, global};
use opentelemetry_otlp::{SpanExporter, WithExportConfig};
//use opentelemetry_sdk::runtime::Tokio;
use opentelemetry_sdk::Resource;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/examples/tracing-tracy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
use hyperlight_host::sandbox_state::transition::Noop;
use hyperlight_host::{GuestBinary, MultiUseSandbox, Result};
use hyperlight_testing::simple_guest_as_string;
use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::EnvFilter;
use tracing_subscriber::layer::SubscriberExt;

// An example of how to get tracy tracing working with hyperlight.
// Run with:
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/examples/tracing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
#![allow(clippy::disallowed_macros)]
use tracing::{span, Level};
use tracing::{Level, span};
extern crate hyperlight_host;
use std::sync::{Arc, Barrier};
use std::thread::{spawn, JoinHandle};
use std::thread::{JoinHandle, spawn};

use hyperlight_host::sandbox::uninitialized::UninitializedSandbox;
use hyperlight_host::sandbox_state::sandbox::EvolvableSandbox;
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/func/call_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

use tracing::{instrument, Span};
use tracing::{Span, instrument};

use super::{ParameterTuple, SupportedReturnType};
use crate::{MultiUseSandbox, Result};
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/func/guest_err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::error::HyperlightError::{GuestError, StackOverflow};
use crate::mem::shared_mem::HostSharedMemory;
use crate::metrics::{METRIC_GUEST_ERROR, METRIC_GUEST_ERROR_LABEL_CODE};
use crate::sandbox::mem_mgr::MemMgrWrapper;
use crate::{log_then_return, Result};
use crate::{Result, log_then_return};

/// Check for a guest error and return an `Err` if one was found,
/// and `Ok` if one was not found.
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/func/host_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterValue, Ret
use super::utils::for_each_tuple;
use super::{ParameterTuple, ResultType, SupportedReturnType};
use crate::sandbox::{ExtraAllowedSyscall, UninitializedSandbox};
use crate::{log_then_return, new_error, Result};
use crate::{Result, log_then_return, new_error};

/// A representation of a host function.
/// This is a thin wrapper around a `Fn(Args) -> Result<Output>`.
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/func/param_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ limitations under the License.
*/

use hyperlight_common::flatbuffer_wrappers::function_types::{ParameterType, ParameterValue};
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use super::utils::for_each_tuple;
use crate::HyperlightError::{ParameterValueConversionFailure, UnexpectedNoOfArguments};
use crate::{log_then_return, Result};
use crate::{Result, log_then_return};

/// This is a marker trait that is used to indicate that a type is a
/// valid Hyperlight parameter type.
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/func/ret_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ limitations under the License.
*/

use hyperlight_common::flatbuffer_wrappers::function_types::{ReturnType, ReturnValue};
use tracing::{instrument, Span};
use tracing::{Span, instrument};

use crate::HyperlightError::ReturnValueConversionFailure;
use crate::{log_then_return, Result};
use crate::{Result, log_then_return};

/// This is a marker trait that is used to indicate that a type is a valid Hyperlight return type.
pub trait SupportedReturnType: Sized + Clone + Send + Sync + 'static {
Expand Down
2 changes: 1 addition & 1 deletion src/hyperlight_host/src/hypervisor/crashdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::io::Write;
use tempfile::NamedTempFile;

use super::Hypervisor;
use crate::{new_error, Result};
use crate::{Result, new_error};

/// Dump registers + memory regions + raw memory to a tempfile
#[cfg(crashdump)]
Expand Down
4 changes: 2 additions & 2 deletions src/hyperlight_host/src/hypervisor/gdb/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ limitations under the License.
use gdbstub::common::Signal;
use gdbstub::conn::ConnectionExt;
use gdbstub::stub::{
run_blocking, BaseStopReason, DisconnectReason, GdbStub, SingleThreadStopReason,
BaseStopReason, DisconnectReason, GdbStub, SingleThreadStopReason, run_blocking,
};
use libc::{pthread_kill, SIGRTMIN};
use libc::{SIGRTMIN, pthread_kill};

use super::x86_64_target::HyperlightSandboxTarget;
use super::{DebugResponse, GdbTargetError, VcpuStopReason};
Expand Down
Loading