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

@@ -11,8 +11,8 @@ use types::{
time::TimeSlice,
};
use crate::Kernel;
use super::mock_platform::MockPlatform;
use crate::Kernel;
pub fn test_kernel() -> Kernel<MockPlatform> {
let mock = MockPlatform::new(1);
@@ -22,9 +22,7 @@ pub fn test_kernel() -> Kernel<MockPlatform> {
pub fn kernel_with_process() -> (Kernel<MockPlatform>, ProcessId) {
let mut kernel = test_kernel();
let (pid, _tid) = kernel
.boot(Priority::DEFAULT, TimeSlice::DEFAULT)
.unwrap();
let (pid, _tid) = kernel.boot(Priority::DEFAULT, TimeSlice::DEFAULT).unwrap();
(kernel, pid)
}
@@ -35,7 +33,10 @@ impl Kernel<MockPlatform> {
priority: Priority,
time_slice: TimeSlice,
) -> ThreadId {
let tid = self.threads.spawn(pid, priority, time_slice, None).expect("spawn");
let tid = self
.threads
.spawn(pid, priority, time_slice, None)
.expect("spawn");
let _ = self.processes.get_mut(pid).map(|p| p.add_thread(tid));
let core = self.platform.core_id();
self.scheduler.add(tid, priority, core);
@@ -46,11 +47,7 @@ impl Kernel<MockPlatform> {
let _ = self.irqs.register(irq, thread);
}
pub fn block_thread_for_test(
&mut self,
tid: ThreadId,
reason: domain::thread::BlockReason,
) {
pub fn block_thread_for_test(&mut self, tid: ThreadId, reason: domain::thread::BlockReason) {
let core = self.platform.core_id();
if let Ok(t) = self.threads.get_mut(tid) {
if matches!(t.state(), ThreadState::Ready) {
@@ -95,6 +92,7 @@ impl Kernel<MockPlatform> {
resource: Resource,
permissions: PermissionSet,
) -> CapSlot {
self.grant_cap(pid, resource, permissions).expect("grant cap")
self.grant_cap(pid, resource, permissions)
.expect("grant cap")
}
}