Fix clippy errors

This commit is contained in:
2025-03-03 15:51:39 +00:00
parent a0f5ce8797
commit 0a5269eeb0
6 changed files with 19 additions and 14 deletions
@@ -26,7 +26,7 @@ pub struct Locked<T> {
impl<T> Locked<T> {
pub const fn new(inner: T) -> Self {
Locked {
Self {
inner: Mutex::new(inner),
}
}
@@ -144,6 +144,12 @@ pub struct FoundryFallbackAllocator {
head: FallbackListNode,
}
impl Default for FoundryFallbackAllocator {
fn default() -> Self {
Self::new()
}
}
impl FoundryFallbackAllocator {
pub const fn new() -> Self {
Self {
@@ -173,7 +179,7 @@ impl FoundryFallbackAllocator {
let mut current = &mut self.head;
// look for a large enough memory region in linked list
while let Some(ref mut region) = current.next {
if let Ok(alloc_start) = Self::alloc_from_region(&region, size, align) {
if let Ok(alloc_start) = Self::alloc_from_region(region, size, align) {
// region suitable for allocation -> remove node from list
let next = region.next.take();
let ret = Some((current.next.take().unwrap(), alloc_start));
@@ -16,7 +16,7 @@ pub unsafe fn alloc_stack(
size_in_pages: u64,
mapper: &mut impl Mapper<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;
let guard_page = reserve_stack_memory(size_in_pages + 1);
@@ -35,7 +35,7 @@ pub unsafe fn alloc_stack(
start: stack_start.start_address(),
end: stack_end.start_address(),
})
}
}}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
@@ -45,15 +45,15 @@ pub struct StackBounds {
}
impl StackBounds {
pub fn new(start: VirtAddr, end: VirtAddr) -> Self {
pub const fn new(start: VirtAddr, end: VirtAddr) -> Self {
Self { start, end }
}
pub fn start(&self) -> VirtAddr {
pub const fn start(&self) -> VirtAddr {
self.start
}
pub fn end(&self) -> VirtAddr {
pub const fn end(&self) -> VirtAddr {
self.end
}
}