Some more clippy fixes, warnings are noisy
This commit is contained in:
Vendored
+2
-1
@@ -5,5 +5,6 @@
|
|||||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"rust-analyzer.check.command": "clippy"
|
"rust-analyzer.check.command": "clippy",
|
||||||
|
"rust-analyzer.cargo.buildScripts.enable": true
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![expect(unused)]
|
||||||
|
|
||||||
use core::arch::x86_64::__cpuid;
|
use core::arch::x86_64::__cpuid;
|
||||||
|
|
||||||
use crate::arch::x86_64::memory::mapping::PHYSICAL_MEMORY_OFFSET;
|
use crate::arch::x86_64::memory::mapping::PHYSICAL_MEMORY_OFFSET;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#![expect(unused)]
|
||||||
use core::arch::x86_64::__cpuid;
|
use core::arch::x86_64::__cpuid;
|
||||||
use spin::Lazy;
|
use spin::Lazy;
|
||||||
use x86_64::registers::model_specific::Msr;
|
use x86_64::registers::model_specific::Msr;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::missing_safety_doc)]
|
||||||
|
|
||||||
use x86_64::instructions::port::Port;
|
use x86_64::instructions::port::Port;
|
||||||
|
|
||||||
const CMD_INIT: u8 = 0x11;
|
const CMD_INIT: u8 = 0x11;
|
||||||
|
|||||||
@@ -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) {
|
pub unsafe fn init(&mut self, heap_start: usize, heap_size: usize) {
|
||||||
unsafe { self.add_region(heap_start, heap_size) };
|
unsafe { self.add_region(heap_start, heap_size) };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn add_region(&mut self, addr: usize, size: usize) {
|
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 {
|
unsafe {
|
||||||
let mut node = FallbackListNode::new(size);
|
|
||||||
node.next = self.head.next.take();
|
|
||||||
let node_ptr = addr as *mut FallbackListNode;
|
|
||||||
node_ptr.write(node);
|
node_ptr.write(node);
|
||||||
self.head.next = Some(&mut *node_ptr);
|
self.head.next = Some(&mut *node_ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use libm::include_font;
|
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"));
|
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"));
|
Font::new(include_font!("../../../resources/font/cp850-8x16.psf"));
|
||||||
|
|
||||||
// pub struct Font(pub [[u8; 16]; 512]);
|
// pub struct Font(pub [[u8; 16]; 512]);
|
||||||
@@ -39,8 +39,10 @@ impl Font {
|
|||||||
pub const fn height(&self) -> usize {
|
pub const fn height(&self) -> usize {
|
||||||
self.height
|
self.height
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn default() -> &'static Self {
|
impl Default for Font {
|
||||||
&FONT_CP850_8X16
|
fn default() -> Self {
|
||||||
|
FONT_CP850_8X16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ use crate::arch::x86_64::drivers::keyboard::{KeyStroke, get_keystroke_async};
|
|||||||
use crate::resources::font::Font;
|
use crate::resources::font::Font;
|
||||||
use crate::serial_print;
|
use crate::serial_print;
|
||||||
use crate::serial_println;
|
use crate::serial_println;
|
||||||
use crate::std::application::frame::Frame;
|
use crate::std::application::{
|
||||||
use crate::std::application::render::RenderError;
|
Application, Error, frame::Frame, render::RenderError, window::Window,
|
||||||
use crate::std::application::window::Window;
|
};
|
||||||
use crate::std::application::{Application, Error};
|
|
||||||
use crate::std::ascii::Writer;
|
use crate::std::ascii::Writer;
|
||||||
use crate::std::maths::geometry::Vec2;
|
use crate::std::maths::geometry::Vec2;
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
@@ -42,7 +41,8 @@ impl<'a> Editor {
|
|||||||
|
|
||||||
fn render(&'a self) -> Result<Frame<'a>, RenderError> {
|
fn render(&'a self) -> Result<Frame<'a>, RenderError> {
|
||||||
let mut frame = Frame::new(&self.window);
|
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();
|
let (width, height) = writer.font_size().into();
|
||||||
|
|
||||||
@@ -127,7 +127,8 @@ impl<'a> Editor {
|
|||||||
|
|
||||||
fn get_char_idx(&self) -> usize {
|
fn get_char_idx(&self) -> usize {
|
||||||
let frame = Frame::new(&self.window);
|
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 (width, _height) = writer.font_size().into();
|
||||||
|
|
||||||
let mut col = 0;
|
let mut col = 0;
|
||||||
|
|||||||
+4
-5
@@ -1,3 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
#![feature(proc_macro_span)]
|
#![feature(proc_macro_span)]
|
||||||
#![warn(
|
#![warn(
|
||||||
clippy::correctness,
|
clippy::correctness,
|
||||||
@@ -10,9 +11,6 @@
|
|||||||
rustdoc::missing_panics_doc
|
rustdoc::missing_panics_doc
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::{Read, Seek, SeekFrom};
|
|
||||||
|
|
||||||
use proc_macro::{Span, TokenStream};
|
use proc_macro::{Span, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
@@ -36,7 +34,8 @@ pub fn include_font(item: TokenStream) -> TokenStream {
|
|||||||
let source_filepath: PathBuf = source_file.path();
|
let source_filepath: PathBuf = source_file.path();
|
||||||
let file_path = format!(
|
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()
|
filename.value()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -124,7 +123,7 @@ impl FontBuilder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_psf2(data: &[u8]) -> Result<FontData, &'static str> {
|
const fn parse_psf2(_data: &[u8]) -> Result<FontData, &'static str> {
|
||||||
Err("PSF2 support is not implemented yet!")
|
Err("PSF2 support is not implemented yet!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user