style: cargo fmt kernel crates

This commit is contained in:
2026-10-26 19:07:54 +01:00
parent 818eaecadd
commit 1c04ddf909
50 changed files with 995 additions and 499 deletions

View File

@@ -9,11 +9,11 @@ use types::permission::{Permission, PermissionSet};
fn setup_ipc_kernel() -> (
crate::Kernel<MockPlatform>,
ProcessId, // process A
ProcessId, // process B
CapSlot, // endpoint cap for A (Execute perm)
CapSlot, // endpoint cap for B (Read perm)
ThreadId, // thread B id
ProcessId, // process A
ProcessId, // process B
CapSlot, // endpoint cap for A (Execute perm)
CapSlot, // endpoint cap for B (Read perm)
ThreadId, // thread B id
) {
let (mut k, pid_a) = kernel_with_process();
@@ -27,11 +27,7 @@ fn setup_ipc_kernel() -> (
};
let pid_b = ProcessId::from_raw(1);
let tid_b = k.spawn_thread_for_test(
pid_b,
Priority::DEFAULT,
TimeSlice::DEFAULT,
);
let tid_b = k.spawn_thread_for_test(pid_b, Priority::DEFAULT, TimeSlice::DEFAULT);
// Create an endpoint
let ep_id = k.create_endpoint_for_test();
@@ -65,7 +61,10 @@ fn send_without_receiver_blocks_caller() {
endpoint: cap_a,
message: msg,
});
assert!(matches!(outcome, SyscallOutcome::BlockCaller(BlockReason::Sending(_))));
assert!(matches!(
outcome,
SyscallOutcome::BlockCaller(BlockReason::Sending(_))
));
}
#[test]
@@ -75,10 +74,11 @@ fn receive_without_sender_blocks_caller() {
// Switch to thread B to call Receive
k.switch_to_thread_for_test(tid_b);
let outcome = k.handle_syscall(Syscall::Receive {
endpoint: cap_b,
});
assert!(matches!(outcome, SyscallOutcome::BlockCaller(BlockReason::Receiving(_))));
let outcome = k.handle_syscall(Syscall::Receive { endpoint: cap_b });
assert!(matches!(
outcome,
SyscallOutcome::BlockCaller(BlockReason::Receiving(_))
));
}
#[test]
@@ -196,10 +196,7 @@ fn wait_any_with_ready_source_returns_immediately() {
// Thread A does WaitAny on the endpoint
k.switch_to_thread_for_test(tid_a);
let wait_set = WaitSet::new(
[Some(cap_a), None, None, None],
[None, None, None, None],
);
let wait_set = WaitSet::new([Some(cap_a), None, None, None], [None, None, None, None]);
let outcome = k.handle_syscall(Syscall::WaitAny { sources: wait_set });
assert!(matches!(
outcome,
@@ -210,10 +207,7 @@ fn wait_any_with_ready_source_returns_immediately() {
#[test]
fn wait_any_with_no_ready_source_blocks() {
let (mut k, pid_a, _, cap_a, _, _) = setup_ipc_kernel();
let wait_set = WaitSet::new(
[Some(cap_a), None, None, None],
[None, None, None, None],
);
let wait_set = WaitSet::new([Some(cap_a), None, None, None], [None, None, None, None]);
let outcome = k.handle_syscall(Syscall::WaitAny { sources: wait_set });
assert!(matches!(
outcome,
@@ -224,10 +218,7 @@ fn wait_any_with_no_ready_source_blocks() {
#[test]
fn wait_any_empty_sources_returns_error() {
let (mut k, _, _, _, _, _) = setup_ipc_kernel();
let wait_set = WaitSet::new(
[None, None, None, None],
[None, None, None, None],
);
let wait_set = WaitSet::new([None, None, None, None], [None, None, None, None]);
let outcome = k.handle_syscall(Syscall::WaitAny { sources: wait_set });
assert!(matches!(
outcome,