Fix clippy errors

This commit is contained in:
2025-02-24 15:02:44 +00:00
parent 03290e52a3
commit 8d57540566
15 changed files with 121 additions and 58 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ pub enum InterruptIndex {
}
impl InterruptIndex {
fn as_u8(self) -> u8 {
const fn as_u8(self) -> u8 {
self as u8
}
+4 -5
View File
@@ -48,9 +48,8 @@ pub static _KERNEL_PHYSICAL_MEMORY_OFFSET: Lazy<(u64, u64)> = Lazy::new(|| {
///
/// Panics if the memory map was not found in MEMORY_MAP_REQUEST.
pub fn get_memory_map() -> &'static MemoryMapResponse {
if let Some(memory_map) = MEMORY_MAP_REQUEST.get_response() {
memory_map
} else {
unreachable!("Could not fetch memory map from Limine.")
}
MEMORY_MAP_REQUEST.get_response().map_or_else(
|| unreachable!("Could not fetch memory map from Limine."),
|memory_map| memory_map,
)
}
+3 -3
View File
@@ -55,7 +55,7 @@ pub unsafe fn init(physical_memory_offset: VirtAddr) -> OffsetPageTable<'static>
}
}
pub(crate) struct FoundryOSFrameAllocator {
pub struct FoundryOSFrameAllocator {
memory_map: &'static MemoryMapResponse,
next: usize,
}
@@ -66,8 +66,8 @@ impl FoundryOSFrameAllocator {
/// This function takes a reference to a `MemoryMapResponse` and initializes a
/// `FoundryOSFrameAllocator` with it. The `next` field is set to 0, indicating that
/// the first frame to be allocated is the first frame in the memory map.
pub unsafe fn init(memory_map: &'static MemoryMapResponse) -> FoundryOSFrameAllocator {
FoundryOSFrameAllocator {
pub const unsafe fn init(memory_map: &'static MemoryMapResponse) -> Self {
Self {
memory_map,
next: 0,
}
+1 -1
View File
@@ -4,4 +4,4 @@ pub mod interrupts;
pub mod memory;
pub(crate) mod memmap;
pub mod memmap;
+10
View File
@@ -1,5 +1,15 @@
#![no_std]
#![feature(abi_x86_interrupt)]
#![warn(
clippy::correctness,
clippy::nursery,
clippy::unnecessary_cast,
clippy::all,
clippy::suspicious,
clippy::perf,
rustdoc::missing_errors_doc,
rustdoc::missing_panics_doc
)]
extern crate alloc;
+1 -3
View File
@@ -4,13 +4,11 @@
extern crate alloc;
use libk::{
// scheduling::task::{Executor, Task},
drivers::{
io::{self, ascii::WRITER, keyboard},
io::{self, keyboard},
scheduling::task::{Executor, Task},
},
prelude::*,
resources::font::FONT_SPLEEN_8X16,
};
#[unsafe(no_mangle)]