diff --git a/.vscode/settings.json b/.vscode/settings.json
index 17d2304..5b7e9e1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -5,5 +5,6 @@
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
},
- "rust-analyzer.check.command": "clippy"
+ "rust-analyzer.check.command": "clippy",
+ "rust-analyzer.cargo.buildScripts.enable": true
}
\ No newline at end of file
diff --git a/kernel/src/arch/x86_64/cpu/apic.rs b/kernel/src/arch/x86_64/cpu/apic.rs
index 3672f38..bcb94cd 100644
--- a/kernel/src/arch/x86_64/cpu/apic.rs
+++ b/kernel/src/arch/x86_64/cpu/apic.rs
@@ -1,3 +1,5 @@
+#![expect(unused)]
+
use core::arch::x86_64::__cpuid;
use crate::arch::x86_64::memory::mapping::PHYSICAL_MEMORY_OFFSET;
diff --git a/kernel/src/arch/x86_64/cpu/msr.rs b/kernel/src/arch/x86_64/cpu/msr.rs
index 5dae062..0463b70 100644
--- a/kernel/src/arch/x86_64/cpu/msr.rs
+++ b/kernel/src/arch/x86_64/cpu/msr.rs
@@ -1,3 +1,4 @@
+#![expect(unused)]
use core::arch::x86_64::__cpuid;
use spin::Lazy;
use x86_64::registers::model_specific::Msr;
diff --git a/kernel/src/arch/x86_64/cpu/pic.rs b/kernel/src/arch/x86_64/cpu/pic.rs
index b43313d..4f95008 100644
--- a/kernel/src/arch/x86_64/cpu/pic.rs
+++ b/kernel/src/arch/x86_64/cpu/pic.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::missing_safety_doc)]
+
use x86_64::instructions::port::Port;
const CMD_INIT: u8 = 0x11;
diff --git a/kernel/src/arch/x86_64/memory/allocation/heap_alloc.rs b/kernel/src/arch/x86_64/memory/allocation/heap_alloc.rs
index 41baa41..4173efd 100644
--- a/kernel/src/arch/x86_64/memory/allocation/heap_alloc.rs
+++ b/kernel/src/arch/x86_64/memory/allocation/heap_alloc.rs
@@ -173,15 +173,22 @@ impl FoundryFallbackAllocator {
}
}
+ /// Initialises the Foundry OS fallback allocator. This is currently a
+ /// linked list allocator pulled from the linked_list_allocator crate.
+ ///
+ /// # Safety
+ ///
+ /// This function assumes you passed a valid `heap_start` and `heap_size`,
+ /// as these are unchecked.
pub unsafe fn init(&mut self, heap_start: usize, heap_size: usize) {
unsafe { self.add_region(heap_start, heap_size) };
}
unsafe fn add_region(&mut self, addr: usize, size: usize) {
+ let mut node = FallbackListNode::new(size);
+ node.next = self.head.next.take();
+ let node_ptr = addr as *mut FallbackListNode;
unsafe {
- let mut node = FallbackListNode::new(size);
- node.next = self.head.next.take();
- let node_ptr = addr as *mut FallbackListNode;
node_ptr.write(node);
self.head.next = Some(&mut *node_ptr);
}
diff --git a/kernel/src/resources/font/mod.rs b/kernel/src/resources/font/mod.rs
index ebe52ed..cc6b52a 100644
--- a/kernel/src/resources/font/mod.rs
+++ b/kernel/src/resources/font/mod.rs
@@ -1,8 +1,8 @@
use libm::include_font;
-pub static FONT_SPLEEN_8X16: Font =
+pub const FONT_SPLEEN_8X16: Font =
Font::new(include_font!("../../../resources/font/spleen-8x16.psf"));
-pub static FONT_CP850_8X16: Font =
+pub const FONT_CP850_8X16: Font =
Font::new(include_font!("../../../resources/font/cp850-8x16.psf"));
// pub struct Font(pub [[u8; 16]; 512]);
@@ -39,8 +39,10 @@ impl Font {
pub const fn height(&self) -> usize {
self.height
}
+}
- pub fn default() -> &'static Self {
- &FONT_CP850_8X16
+impl Default for Font {
+ fn default() -> Self {
+ FONT_CP850_8X16
}
}
diff --git a/kernel/src/util/editor.rs b/kernel/src/util/editor.rs
index baa454c..abb21c1 100644
--- a/kernel/src/util/editor.rs
+++ b/kernel/src/util/editor.rs
@@ -2,10 +2,9 @@ use crate::arch::x86_64::drivers::keyboard::{KeyStroke, get_keystroke_async};
use crate::resources::font::Font;
use crate::serial_print;
use crate::serial_println;
-use crate::std::application::frame::Frame;
-use crate::std::application::render::RenderError;
-use crate::std::application::window::Window;
-use crate::std::application::{Application, Error};
+use crate::std::application::{
+ Application, Error, frame::Frame, render::RenderError, window::Window,
+};
use crate::std::ascii::Writer;
use crate::std::maths::geometry::Vec2;
use alloc::string::{String, ToString};
@@ -42,7 +41,8 @@ impl<'a> Editor {
fn render(&'a self) -> Result, RenderError> {
let mut frame = Frame::new(&self.window);
- let writer = Writer::new(Font::default());
+ let font = Font::default();
+ let writer = Writer::new(&font);
let (width, height) = writer.font_size().into();
@@ -127,7 +127,8 @@ impl<'a> Editor {
fn get_char_idx(&self) -> usize {
let frame = Frame::new(&self.window);
- let writer = Writer::new(Font::default());
+ let font = Font::default();
+ let writer = Writer::new(&font);
let (width, _height) = writer.font_size().into();
let mut col = 0;
diff --git a/libm/src/lib.rs b/libm/src/lib.rs
index 7a30e03..bf776c0 100644
--- a/libm/src/lib.rs
+++ b/libm/src/lib.rs
@@ -1,3 +1,4 @@
+#![allow(dead_code)]
#![feature(proc_macro_span)]
#![warn(
clippy::correctness,
@@ -10,9 +11,6 @@
rustdoc::missing_panics_doc
)]
-use std::fs::File;
-use std::io::{Read, Seek, SeekFrom};
-
use proc_macro::{Span, TokenStream};
use quote::quote;
use std::path::PathBuf;
@@ -36,7 +34,8 @@ pub fn include_font(item: TokenStream) -> TokenStream {
let source_filepath: PathBuf = source_file.path();
let file_path = format!(
"{}/{}",
- source_filepath.parent().unwrap_or_else(|| panic!("Expected to find the calling source file in a folder like src! Got: {}", source_filepath.display())).display(),
+ source_filepath.parent()
+ .unwrap_or_else(|| panic!("Expected to find the calling source file in a folder like src! Got: {}", source_filepath.display())).display(),
filename.value()
);
@@ -124,7 +123,7 @@ impl FontBuilder {
})
}
- fn parse_psf2(data: &[u8]) -> Result {
+ const fn parse_psf2(_data: &[u8]) -> Result {
Err("PSF2 support is not implemented yet!")
}
}