Fix more clippy errors, missing safety docs

This commit is contained in:
2025-02-28 22:21:51 +00:00
parent 4bad44e475
commit fdd556f742
8 changed files with 16 additions and 22 deletions
-1
View File
@@ -1,4 +1,3 @@
#![expect(unused)]
use core::arch::x86_64::__cpuid;
use spin::Lazy;
use x86_64::registers::model_specific::Msr;
-1
View File
@@ -1,5 +1,4 @@
//! Functions for IO using ports.
#![expect(unused)]
use core::arch::asm;
/// Take a byte in from a port.
+5 -9
View File
@@ -1,4 +1,4 @@
#![expect(unused)]
#![allow(clippy::missing_safety_doc)]
use x86_64::instructions::port::Port;
const CMD_INIT: u8 = 0x11;
@@ -41,7 +41,8 @@ pub struct ChainedPics {
}
impl ChainedPics {
pub const unsafe fn new(offset1: u8, offset2: u8) -> Self {
/// Creates a new [`ChainedPics`].
pub const fn new(offset1: u8, offset2: u8) -> Self {
Self {
pics: [
Pic {
@@ -58,13 +59,8 @@ impl ChainedPics {
}
}
/// .
///
/// # Safety
///
/// .
pub const unsafe fn new_contiguous(primary_offset: u8) -> Self {
unsafe { Self::new(primary_offset, primary_offset + 8) }
pub const fn new_contiguous(primary_offset: u8) -> Self {
Self::new(primary_offset, primary_offset + 8)
}
/// Returns the initialize of this [`ChainedPics`].
-1
View File
@@ -1,4 +1,3 @@
#![expect(unused)]
use x86_64::{
VirtAddr,
instructions::tables::load_tss,
-2
View File
@@ -1,5 +1,3 @@
#![expect(unused)]
use pic8259::ChainedPics;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
-1
View File
@@ -47,7 +47,6 @@ pub static _KERNEL_PHYSICAL_MEMORY_OFFSET: Lazy<(u64, u64)> = Lazy::new(|| {
/// # Panics
///
/// Panics if the memory map was not found in MEMORY_MAP_REQUEST.
#[expect(unused)]
pub fn get_memory_map() -> &'static MemoryMapResponse {
MEMORY_MAP_REQUEST.get_response().map_or_else(
|| unreachable!("Could not fetch memory map from Limine."),
+5 -3
View File
@@ -1,4 +1,3 @@
#![expect(dead_code)]
use core::fmt;
use spin::{Lazy, Mutex};
use x86_64::instructions::interrupts;
@@ -171,18 +170,21 @@ fn write(args: fmt::Arguments, fg: Colour, bg: Colour) {
});
}
#[doc(hidden)]
pub fn _print(args: fmt::Arguments) {
x86_64::instructions::interrupts::without_interrupts(|| {
write(args, Colour::White, Colour::Black);
})
}
#[doc(hidden)]
pub fn _print_err(args: fmt::Arguments) {
x86_64::instructions::interrupts::without_interrupts(|| {
write(args, Colour::Red, Colour::Black);
})
}
#[doc(hidden)]
pub fn _print_log(args: fmt::Arguments) {
x86_64::instructions::interrupts::without_interrupts(|| {
write(args, Colour::Yellow, Colour::Black);
@@ -228,7 +230,7 @@ macro_rules! println {
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ($crate::_print(format_args!($($arg)*)));
($($arg:tt)*) => ($crate::graphics::writer::_print(format_args!($($arg)*)));
}
#[macro_export]
@@ -239,5 +241,5 @@ macro_rules! printlnerr {
#[macro_export]
macro_rules! printerr {
($($arg:tt)*) => ($crate::_print_err(format_args!($($arg)*)));
($($arg:tt)*) => ($crate::graphics::writer::_print_err(format_args!($($arg)*)));
}
+6 -4
View File
@@ -15,9 +15,9 @@ use core::arch::asm;
use graphics::font::{FONT_SPLEEN_8X16, Font};
use limine::BaseRevision;
mod arch;
mod graphics;
mod io;
pub mod arch;
pub mod graphics;
pub mod io;
/// Sets the base revision to the latest revision supported by the crate.
/// See specification for further info.
@@ -45,8 +45,10 @@ pub fn hcf() -> ! {
}
pub fn boot() -> Result<(), &'static str> {
println!("Test!");
if !BASE_REVISION.is_supported() {
return Err("base revision not supported");
return Err("Base Revision was not supported.");
}
Ok(())