Fix clippy errors
This commit is contained in:
@@ -49,7 +49,7 @@ impl ChainedPics {
|
|||||||
/// conflict with one another, the resulting object will be useless and
|
/// conflict with one another, the resulting object will be useless and
|
||||||
/// will likely cause problems for your system.
|
/// will likely cause problems for your system.
|
||||||
pub const unsafe fn new(offset1: u8, offset2: u8) -> Self {
|
pub const unsafe fn new(offset1: u8, offset2: u8) -> Self {
|
||||||
ChainedPics {
|
Self {
|
||||||
pics: [
|
pics: [
|
||||||
Pic {
|
Pic {
|
||||||
offset: offset1,
|
offset: offset1,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub struct Locked<T> {
|
|||||||
|
|
||||||
impl<T> Locked<T> {
|
impl<T> Locked<T> {
|
||||||
pub const fn new(inner: T) -> Self {
|
pub const fn new(inner: T) -> Self {
|
||||||
Locked {
|
Self {
|
||||||
inner: Mutex::new(inner),
|
inner: Mutex::new(inner),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,12 @@ pub struct FoundryFallbackAllocator {
|
|||||||
head: FallbackListNode,
|
head: FallbackListNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for FoundryFallbackAllocator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl FoundryFallbackAllocator {
|
impl FoundryFallbackAllocator {
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -173,7 +179,7 @@ impl FoundryFallbackAllocator {
|
|||||||
let mut current = &mut self.head;
|
let mut current = &mut self.head;
|
||||||
// look for a large enough memory region in linked list
|
// look for a large enough memory region in linked list
|
||||||
while let Some(ref mut region) = current.next {
|
while let Some(ref mut region) = current.next {
|
||||||
if let Ok(alloc_start) = Self::alloc_from_region(®ion, size, align) {
|
if let Ok(alloc_start) = Self::alloc_from_region(region, size, align) {
|
||||||
// region suitable for allocation -> remove node from list
|
// region suitable for allocation -> remove node from list
|
||||||
let next = region.next.take();
|
let next = region.next.take();
|
||||||
let ret = Some((current.next.take().unwrap(), alloc_start));
|
let ret = Some((current.next.take().unwrap(), alloc_start));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pub unsafe fn alloc_stack(
|
|||||||
size_in_pages: u64,
|
size_in_pages: u64,
|
||||||
mapper: &mut impl Mapper<Size4KiB>,
|
mapper: &mut impl Mapper<Size4KiB>,
|
||||||
frame_allocator: &mut impl FrameAllocator<Size4KiB>,
|
frame_allocator: &mut impl FrameAllocator<Size4KiB>,
|
||||||
) -> Result<StackBounds, mapper::MapToError<Size4KiB>> {
|
) -> Result<StackBounds, mapper::MapToError<Size4KiB>> { unsafe {
|
||||||
use x86_64::structures::paging::PageTableFlags as Flags;
|
use x86_64::structures::paging::PageTableFlags as Flags;
|
||||||
|
|
||||||
let guard_page = reserve_stack_memory(size_in_pages + 1);
|
let guard_page = reserve_stack_memory(size_in_pages + 1);
|
||||||
@@ -35,7 +35,7 @@ pub unsafe fn alloc_stack(
|
|||||||
start: stack_start.start_address(),
|
start: stack_start.start_address(),
|
||||||
end: stack_end.start_address(),
|
end: stack_end.start_address(),
|
||||||
})
|
})
|
||||||
}
|
}}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
@@ -45,15 +45,15 @@ pub struct StackBounds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StackBounds {
|
impl StackBounds {
|
||||||
pub fn new(start: VirtAddr, end: VirtAddr) -> Self {
|
pub const fn new(start: VirtAddr, end: VirtAddr) -> Self {
|
||||||
Self { start, end }
|
Self { start, end }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(&self) -> VirtAddr {
|
pub const fn start(&self) -> VirtAddr {
|
||||||
self.start
|
self.start
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn end(&self) -> VirtAddr {
|
pub const fn end(&self) -> VirtAddr {
|
||||||
self.end
|
self.end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,13 @@ pub struct Thread {
|
|||||||
pub struct ThreadId(u64);
|
pub struct ThreadId(u64);
|
||||||
|
|
||||||
impl ThreadId {
|
impl ThreadId {
|
||||||
pub fn as_u64(&self) -> u64 {
|
pub const fn as_u64(&self) -> u64 {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
use core::sync::atomic::{AtomicU64, Ordering};
|
use core::sync::atomic::{AtomicU64, Ordering};
|
||||||
static NEXT_THREAD_ID: AtomicU64 = AtomicU64::new(1);
|
static NEXT_THREAD_ID: AtomicU64 = AtomicU64::new(1);
|
||||||
ThreadId(NEXT_THREAD_ID.fetch_add(1, Ordering::Relaxed))
|
Self(NEXT_THREAD_ID.fetch_add(1, Ordering::Relaxed))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ pub struct Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Font {
|
impl Font {
|
||||||
pub const fn new(data: [[u8; 16]; 512]) -> Font {
|
pub const fn new(data: [[u8; 16]; 512]) -> Self {
|
||||||
Font {
|
Self {
|
||||||
width: 8,
|
width: 8,
|
||||||
height: 16,
|
height: 16,
|
||||||
length: data.len() as u16,
|
length: data.len() as u16,
|
||||||
@@ -40,7 +40,7 @@ impl Font {
|
|||||||
self.height
|
self.height
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default() -> &'static Font {
|
pub fn default() -> &'static Self {
|
||||||
&FONT_CP850_8X16
|
&FONT_CP850_8X16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use crate::serial_print;
|
use crate::serial_print;
|
||||||
use crate::arch::x86_64::drivers::keyboard::{KeyStroke, get_keystroke_async};
|
use crate::arch::x86_64::drivers::keyboard::{KeyStroke, get_keystroke_async};
|
||||||
use crate::prelude::*;
|
|
||||||
use crate::resources::font::Font;
|
use crate::resources::font::Font;
|
||||||
use crate::std::application::frame::Frame;
|
use crate::std::application::frame::Frame;
|
||||||
use crate::std::application::render::RenderError;
|
use crate::std::application::render::RenderError;
|
||||||
|
|||||||
Reference in New Issue
Block a user