修复内核的clippy检查报错 (#637)

修复内核的clippy检查报错
---------

Co-authored-by: Samuel Dai <947309196@qq.com>
Co-authored-by: Donkey Kane <109840258+xiaolin2004@users.noreply.github.com>
Co-authored-by: themildwind <107623059+themildwind@users.noreply.github.com>
Co-authored-by: GnoCiYeH <heyicong@dragonos.org>
Co-authored-by: MemoryShore <105195940+MemoryShore@users.noreply.github.com>
Co-authored-by: 曾俊 <110876916+ZZJJWarth@users.noreply.github.com>
Co-authored-by: sun5etop <146408999+sun5etop@users.noreply.github.com>
Co-authored-by: hmt <114841534+1037827920@users.noreply.github.com>
Co-authored-by: laokengwt <143977175+laokengwt@users.noreply.github.com>
Co-authored-by: TTaq <103996388+TTaq@users.noreply.github.com>
Co-authored-by: Jomo <2512364506@qq.com>
Co-authored-by: Samuel Dai <samuka007@qq.com>
Co-authored-by: sspphh <112558065+sspphh@users.noreply.github.com>
This commit is contained in:
LoGin
2024-03-22 23:26:39 +08:00
committed by GitHub
parent 4695947e1b
commit b5b571e026
175 changed files with 1820 additions and 2155 deletions

View File

@ -293,7 +293,7 @@ impl<Arch: MemoryManagementArch> PageFlags<Arch> {
#[inline(always)]
pub const unsafe fn from_data(data: usize) -> Self {
return Self {
data: data,
data,
phantom: PhantomData,
};
}
@ -624,7 +624,7 @@ impl<Arch: MemoryManagementArch, F: FrameAllocator> PageMapper<Arch, F> {
if table.level() == 0 {
// todo: 检查是否已经映射
// 现在不检查的原因是,刚刚启动系统时,内核会映射一些页。
if table.entry_mapped(i)? == true {
if table.entry_mapped(i)? {
kwarn!("Page {:?} already mapped", virt);
}
@ -752,8 +752,8 @@ impl<Arch: MemoryManagementArch, F: FrameAllocator> PageMapper<Arch, F> {
return None;
}
let mut table = self.table();
return unmap_phys_inner(virt, &mut table, unmap_parents, self.allocator_mut())
let table = self.table();
return unmap_phys_inner(virt, &table, unmap_parents, self.allocator_mut())
.map(|(paddr, flags)| (paddr, flags, PageFlush::<Arch>::new(virt)));
}
@ -805,9 +805,9 @@ unsafe fn unmap_phys_inner<Arch: MemoryManagementArch>(
return Some((entry.address().ok()?, entry.flags()));
}
let mut subtable = table.next_level_table(i)?;
let subtable = table.next_level_table(i)?;
// 递归地取消映射
let result = unmap_phys_inner(vaddr, &mut subtable, unmap_parents, allocator)?;
let result = unmap_phys_inner(vaddr, &subtable, unmap_parents, allocator)?;
// TODO: This is a bad idea for architectures where the kernel mappings are done in the process tables,
// as these mappings may become out of sync