diff --git a/kernel/comps/block/src/lib.rs b/kernel/comps/block/src/lib.rs index db3802125..13142b146 100644 --- a/kernel/comps/block/src/lib.rs +++ b/kernel/comps/block/src/lib.rs @@ -31,7 +31,6 @@ #![feature(fn_traits)] #![feature(step_trait)] #![feature(trait_upcasting)] -#![allow(dead_code)] extern crate alloc; diff --git a/kernel/comps/mlsdisk/src/tx/current.rs b/kernel/comps/mlsdisk/src/tx/current.rs index b436f5ffb..af8db39fa 100644 --- a/kernel/comps/mlsdisk/src/tx/current.rs +++ b/kernel/comps/mlsdisk/src/tx/current.rs @@ -117,7 +117,6 @@ impl<'a> CurrentTx<'a> { /// /// In addition, the `get_current_mut_with` method must _not_ be called /// recursively. - #[allow(dropping_references)] fn get_current_mut_with(&self, f: F) -> R where F: FnOnce(&mut Tx) -> R, diff --git a/kernel/comps/softirq/src/taskless.rs b/kernel/comps/softirq/src/taskless.rs index dba5a3709..8c067f4c7 100644 --- a/kernel/comps/softirq/src/taskless.rs +++ b/kernel/comps/softirq/src/taskless.rs @@ -60,7 +60,6 @@ pub struct Taskless { /// The function that will be called when executing this taskless job. callback: Box>, /// Whether this `Taskless` is disabled. - #[allow(unused)] is_disabled: AtomicBool, link: LinkedListAtomicLink, } @@ -74,7 +73,6 @@ cpu_local! { impl Taskless { /// Creates a new `Taskless` instance with its callback function. - #[allow(unused)] pub fn new(callback: F) -> Arc where F: FnMut() + Send + Sync + 'static, @@ -95,7 +93,6 @@ impl Taskless { /// Schedules this taskless job and it will be executed in later time. /// /// If the taskless job has been scheduled, this function will do nothing. - #[allow(unused)] pub fn schedule(self: &Arc) { do_schedule(self, &TASKLESS_LIST); SoftIrqLine::get(TASKLESS_SOFTIRQ_ID).raise(); @@ -105,7 +102,6 @@ impl Taskless { /// in softirq context. /// /// If the taskless job has been scheduled, this function will do nothing. - #[allow(unused)] pub fn schedule_urgent(self: &Arc) { do_schedule(self, &TASKLESS_URGENT_LIST); SoftIrqLine::get(TASKLESS_URGENT_SOFTIRQ_ID).raise(); @@ -114,20 +110,17 @@ impl Taskless { /// Enables this `Taskless` so that it can be executed once it has been scheduled. /// /// A new `Taskless` is enabled by default. - #[allow(unused)] pub fn enable(&self) { self.is_disabled.store(false, Ordering::Release); } /// Disables this `Taskless` so that it can not be scheduled. Note that if the `Taskless` /// has been scheduled, it can still continue to complete this job. - #[allow(unused)] pub fn disable(&self) { self.is_disabled.store(true, Ordering::Release); } } -#[allow(unused)] fn do_schedule( taskless: &Arc, taskless_list: &'static CpuLocal>>, diff --git a/kernel/comps/virtio/src/device/socket/header.rs b/kernel/comps/virtio/src/device/socket/header.rs index 339e60c66..d8820b562 100644 --- a/kernel/comps/virtio/src/device/socket/header.rs +++ b/kernel/comps/virtio/src/device/socket/header.rs @@ -118,7 +118,6 @@ impl VirtioVsockHdr { #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, TryFromInt)] #[repr(u16)] -#[allow(non_camel_case_types)] pub enum VirtioVsockOp { #[default] Invalid = 0, diff --git a/kernel/comps/virtio/src/dma_buf.rs b/kernel/comps/virtio/src/dma_buf.rs index 8a52413d5..3207f11c7 100644 --- a/kernel/comps/virtio/src/dma_buf.rs +++ b/kernel/comps/virtio/src/dma_buf.rs @@ -7,7 +7,6 @@ use ostd::mm::{DmaCoherent, DmaStream, DmaStreamSlice, HasDaddr}; /// /// Any type implements this trait should also implements `HasDaddr` trait, /// and provides the exact length of DMA area. -#[allow(clippy::len_without_is_empty)] pub trait DmaBuf: HasDaddr { /// The length of Dma area, in bytes fn len(&self) -> usize; diff --git a/kernel/libs/aster-rights-proc/src/lib.rs b/kernel/libs/aster-rights-proc/src/lib.rs index a7e28acfe..98b1d5644 100644 --- a/kernel/libs/aster-rights-proc/src/lib.rs +++ b/kernel/libs/aster-rights-proc/src/lib.rs @@ -73,7 +73,6 @@ //! ``` #![feature(proc_macro_diagnostic)] -#![allow(dead_code)] use require_item::RequireItem; use syn::parse_macro_input; diff --git a/kernel/libs/atomic-integer-wrapper/src/lib.rs b/kernel/libs/atomic-integer-wrapper/src/lib.rs index eb6a23cca..3e76a5770 100644 --- a/kernel/libs/atomic-integer-wrapper/src/lib.rs +++ b/kernel/libs/atomic-integer-wrapper/src/lib.rs @@ -152,7 +152,6 @@ pub fn define_atomic_version_of_integer_like_type(input: TokenStream) -> TokenSt } }; let fn_swap = quote! { - #[allow(dead_code)] pub fn swap( &self, val: impl Into<#integer_like_type>, @@ -162,7 +161,6 @@ pub fn define_atomic_version_of_integer_like_type(input: TokenStream) -> TokenSt } }; let fn_compare_exchange = quote! { - #[allow(dead_code)] pub fn compare_exchange( &self, current: impl Into<#integer_like_type>, @@ -182,7 +180,6 @@ pub fn define_atomic_version_of_integer_like_type(input: TokenStream) -> TokenSt } }; let fn_fetch_update = quote! { - #[allow(dead_code)] pub fn fetch_update( &self, set_order: core::sync::atomic::Ordering, diff --git a/kernel/libs/comp-sys/component-macro/src/lib.rs b/kernel/libs/comp-sys/component-macro/src/lib.rs index 5254a8609..51246e403 100644 --- a/kernel/libs/comp-sys/component-macro/src/lib.rs +++ b/kernel/libs/comp-sys/component-macro/src/lib.rs @@ -3,7 +3,6 @@ //!This crate defines the component system related macros. #![feature(proc_macro_diagnostic)] -#![allow(dead_code)] #![deny(unsafe_code)] mod init_comp; diff --git a/kernel/src/fs/exfat/dentry.rs b/kernel/src/fs/exfat/dentry.rs index a0191c68e..46be20764 100644 --- a/kernel/src/fs/exfat/dentry.rs +++ b/kernel/src/fs/exfat/dentry.rs @@ -58,7 +58,6 @@ const EXFAT_UNUSED: u8 = 0x00; #[allow(dead_code)] const EXFAT_INVAL: u8 = 0x80; const EXFAT_BITMAP: u8 = 0x81; -#[allow(dead_code)] const EXFAT_UPCASE: u8 = 0x82; #[allow(dead_code)] const EXFAT_VOLUME: u8 = 0x83; diff --git a/kernel/src/fs/ext2/dir.rs b/kernel/src/fs/ext2/dir.rs index d143f5978..7c8308d3a 100644 --- a/kernel/src/fs/ext2/dir.rs +++ b/kernel/src/fs/ext2/dir.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] - use super::{inode::MAX_FNAME_LEN, prelude::*}; /// The data structure in a directory's data block. It is stored in a linked list. diff --git a/kernel/src/fs/ramfs/fs.rs b/kernel/src/fs/ramfs/fs.rs index fa97946a6..8aaf3e08a 100644 --- a/kernel/src/fs/ramfs/fs.rs +++ b/kernel/src/fs/ramfs/fs.rs @@ -109,7 +109,6 @@ struct RamInode { } /// Inode inner specifics. -#[allow(clippy::large_enum_variant)] enum Inner { Dir(RwLock), File(PageCache), diff --git a/kernel/src/ipc/mod.rs b/kernel/src/ipc/mod.rs index 07abf416f..af39a4267 100644 --- a/kernel/src/ipc/mod.rs +++ b/kernel/src/ipc/mod.rs @@ -41,7 +41,6 @@ pub enum IpcControlCmd { } #[derive(Debug)] -#[allow(dead_code)] pub struct IpcPermission { key: key_t, /// Owner's UID diff --git a/kernel/src/process/credentials/c_types.rs b/kernel/src/process/credentials/c_types.rs index 62a43ac82..9757ffc2f 100644 --- a/kernel/src/process/credentials/c_types.rs +++ b/kernel/src/process/credentials/c_types.rs @@ -1,5 +1,4 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(non_camel_case_types)] use crate::{prelude::*, process::Pid}; diff --git a/kernel/src/process/credentials/static_cap.rs b/kernel/src/process/credentials/static_cap.rs index f6a6b63b8..b79ed965f 100644 --- a/kernel/src/process/credentials/static_cap.rs +++ b/kernel/src/process/credentials/static_cap.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] - use aster_rights::{Dup, Read, TRights, Write}; use aster_rights_proc::require; use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard}; diff --git a/kernel/src/process/posix_thread/mod.rs b/kernel/src/process/posix_thread/mod.rs index 9698b1612..52fec6eee 100644 --- a/kernel/src/process/posix_thread/mod.rs +++ b/kernel/src/process/posix_thread/mod.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] - use core::sync::atomic::{AtomicU32, Ordering}; use aster_rights::{ReadOp, WriteOp}; diff --git a/kernel/src/process/process/mod.rs b/kernel/src/process/process/mod.rs index 149727a28..6367bc006 100644 --- a/kernel/src/process/process/mod.rs +++ b/kernel/src/process/process/mod.rs @@ -171,7 +171,6 @@ impl Process { Some(Task::current()?.as_posix_thread()?.process()) } - #[allow(clippy::too_many_arguments)] fn new( pid: Pid, parent: Weak, diff --git a/kernel/src/process/program_loader/elf/load_elf.rs b/kernel/src/process/program_loader/elf/load_elf.rs index 4ca0c5002..8b9ae1ead 100644 --- a/kernel/src/process/program_loader/elf/load_elf.rs +++ b/kernel/src/process/program_loader/elf/load_elf.rs @@ -1,7 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 #![allow(dead_code)] -#![allow(unused_variables)] //! This module is used to parse elf file content to get elf_load_info. //! When create a process from elf file, we will use the elf_load_info to construct the VmSpace diff --git a/kernel/src/sched/priority_scheduler.rs b/kernel/src/sched/priority_scheduler.rs index 803e2d254..efdee4cc0 100644 --- a/kernel/src/sched/priority_scheduler.rs +++ b/kernel/src/sched/priority_scheduler.rs @@ -21,7 +21,6 @@ use super::{ }; use crate::{prelude::*, thread::Thread}; -#[allow(unused)] pub fn init() { let preempt_scheduler = Box::new(PreemptScheduler::default()); let scheduler = Box::>::leak(preempt_scheduler); diff --git a/kernel/src/syscall/mmap.rs b/kernel/src/syscall/mmap.rs index fbbaa084c..7db39416c 100644 --- a/kernel/src/syscall/mmap.rs +++ b/kernel/src/syscall/mmap.rs @@ -237,7 +237,6 @@ impl MMapOptions { self.typ } - #[allow(unused)] pub fn flags(&self) -> MMapFlags { self.flags } diff --git a/kernel/src/syscall/sigaltstack.rs b/kernel/src/syscall/sigaltstack.rs index 1f3faab6b..f679c9341 100644 --- a/kernel/src/syscall/sigaltstack.rs +++ b/kernel/src/syscall/sigaltstack.rs @@ -75,7 +75,6 @@ fn set_new_stack(sig_stack_addr: Vaddr, old_stack: Option<&SigStack>, ctx: &Cont Ok(()) } -#[allow(non_camel_case_types)] #[derive(Debug, Clone, Copy, Pod)] #[repr(C)] struct stack_t { diff --git a/kernel/src/util/net/addr/family.rs b/kernel/src/util/net/addr/family.rs index 11f70eb0e..6fe92c443 100644 --- a/kernel/src/util/net/addr/family.rs +++ b/kernel/src/util/net/addr/family.rs @@ -13,7 +13,6 @@ use crate::{current_userspace, net::socket::SocketAddr, prelude::*}; #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq)] #[allow(non_camel_case_types)] -#[allow(dead_code)] pub enum CSocketAddrFamily { AF_UNSPEC = 0, /// Unix domain sockets diff --git a/kernel/src/util/net/addr/unix.rs b/kernel/src/util/net/addr/unix.rs index 0d5a4ec7a..ab6ca92f6 100644 --- a/kernel/src/util/net/addr/unix.rs +++ b/kernel/src/util/net/addr/unix.rs @@ -46,10 +46,7 @@ where let mut bytes: [u8; CSocketAddrUnix::MAX_LEN + 1] = Pod::new_zeroed(); bytes[..2].copy_from_slice(&(CSocketAddrFamily::AF_UNIX as u16).to_ne_bytes()); - #[allow(clippy::assertions_on_constants)] - const { - assert!(CSocketAddrUnix::PATH_OFFSET == 2) - }; + const { assert!(CSocketAddrUnix::PATH_OFFSET == 2) }; let sun_path = &mut bytes[CSocketAddrUnix::PATH_OFFSET..]; diff --git a/kernel/src/vm/vmar/interval_set.rs b/kernel/src/vm/vmar/interval_set.rs index 1f8598983..026da4adc 100644 --- a/kernel/src/vm/vmar/interval_set.rs +++ b/kernel/src/vm/vmar/interval_set.rs @@ -36,7 +36,6 @@ where } } -#[allow(dead_code)] impl IntervalSet where K: Clone + Ord, diff --git a/ostd/src/arch/x86/iommu/registers/mod.rs b/ostd/src/arch/x86/iommu/registers/mod.rs index bcc9963ca..432e8170d 100644 --- a/ostd/src/arch/x86/iommu/registers/mod.rs +++ b/ostd/src/arch/x86/iommu/registers/mod.rs @@ -42,7 +42,6 @@ use crate::{ }; #[derive(Debug, Clone, Copy)] -#[allow(dead_code)] pub struct IommuVersion { major: u8, minor: u8, @@ -65,14 +64,12 @@ impl IommuVersion { /// Important registers used by IOMMU. #[derive(Debug)] pub struct IommuRegisters { - #[allow(dead_code)] version: Volatile<&'static u32, ReadOnly>, capability: Volatile<&'static u64, ReadOnly>, extended_capability: Volatile<&'static u64, ReadOnly>, global_command: Volatile<&'static mut u32, WriteOnly>, global_status: Volatile<&'static u32, ReadOnly>, root_table_address: Volatile<&'static mut u64, ReadWrite>, - #[allow(dead_code)] context_command: Volatile<&'static mut u64, ReadWrite>, interrupt_remapping_table_addr: Volatile<&'static mut u64, ReadWrite>, diff --git a/ostd/src/arch/x86/trap/gdt.rs b/ostd/src/arch/x86/trap/gdt.rs index 9511dd487..2bb956537 100644 --- a/ostd/src/arch/x86/trap/gdt.rs +++ b/ostd/src/arch/x86/trap/gdt.rs @@ -85,7 +85,6 @@ pub unsafe fn init(on_bsp: bool) { // The linker script ensure that cpu_local_tss section is right // at the beginning of cpu_local area, so that gsbase (offset zero) // points to LOCAL_TSS. -#[allow(dead_code)] #[link_section = ".cpu_local_tss"] static LOCAL_TSS: SyncUnsafeCell = SyncUnsafeCell::new(TaskStateSegment::new()); diff --git a/ostd/src/cpu/local/cell.rs b/ostd/src/cpu/local/cell.rs index 97f9131c4..776ce03fb 100644 --- a/ostd/src/cpu/local/cell.rs +++ b/ostd/src/cpu/local/cell.rs @@ -216,7 +216,6 @@ impl> CpuLocalCell { /// /// Note that this memory operation will not be elided or reordered by the /// compiler since it is a black-box. - #[allow(unused)] pub fn bitxor_assign(&'static self, rhs: T) { let offset = self as *const _ as usize - __cpu_local_start as usize; // SAFETY: The CPU-local object is defined in the `.cpu_local` section, diff --git a/ostd/src/cpu/local/single_instr.rs b/ostd/src/cpu/local/single_instr.rs index cb27b33a6..1ac436c0b 100644 --- a/ostd/src/cpu/local/single_instr.rs +++ b/ostd/src/cpu/local/single_instr.rs @@ -114,7 +114,6 @@ pub trait SingleInstructionBitXorAssign { /// # Safety /// /// Please refer to the module-level documentation of [`self`]. - #[allow(unused)] unsafe fn bitxor_assign(offset: *mut Self, rhs: Rhs); } diff --git a/ostd/src/mm/frame/mod.rs b/ostd/src/mm/frame/mod.rs index e11a4cceb..cf8a88fe0 100644 --- a/ostd/src/mm/frame/mod.rs +++ b/ostd/src/mm/frame/mod.rs @@ -210,7 +210,6 @@ impl Frame { /// A physical address to the frame is returned in case the frame needs to be /// restored using [`Frame::from_raw`] later. This is useful when some architectural /// data structures need to hold the frame handle such as the page table. - #[allow(unused)] pub(in crate::mm) fn into_raw(self) -> Paddr { let paddr = self.start_paddr(); core::mem::forget(self); diff --git a/ostd/src/mm/heap_allocator/slab_allocator/mod.rs b/ostd/src/mm/heap_allocator/slab_allocator/mod.rs index 3df57704d..326f32462 100644 --- a/ostd/src/mm/heap_allocator/slab_allocator/mod.rs +++ b/ostd/src/mm/heap_allocator/slab_allocator/mod.rs @@ -258,7 +258,6 @@ impl Heap { } /// Returns total memory size in bytes of the heap. - #[allow(unused)] pub fn total_bytes(&self) -> usize { self.slab_64_bytes.total_blocks() * 64 + self.slab_128_bytes.total_blocks() * 128 @@ -271,7 +270,6 @@ impl Heap { } /// Returns allocated memory size in bytes. - #[allow(unused)] pub fn used_bytes(&self) -> usize { self.slab_64_bytes.used_blocks() * 64 + self.slab_128_bytes.used_blocks() * 128 diff --git a/ostd/src/mm/heap_allocator/slab_allocator/slab.rs b/ostd/src/mm/heap_allocator/slab_allocator/slab.rs index 30bb2c99b..ea80fa5b8 100644 --- a/ostd/src/mm/heap_allocator/slab_allocator/slab.rs +++ b/ostd/src/mm/heap_allocator/slab_allocator/slab.rs @@ -45,12 +45,10 @@ impl Slab { } } - #[allow(unused)] pub fn total_blocks(&self) -> usize { self.total_blocks } - #[allow(unused)] pub fn used_blocks(&self) -> usize { self.total_blocks - self.free_block_list.len() } diff --git a/ostd/src/mm/page_table/cursor.rs b/ostd/src/mm/page_table/cursor.rs index a0a73e1d0..c96261942 100644 --- a/ostd/src/mm/page_table/cursor.rs +++ b/ostd/src/mm/page_table/cursor.rs @@ -94,7 +94,6 @@ pub enum PageTableItem { page: Frame, prop: PageProperty, }, - #[allow(dead_code)] MappedUntracked { va: Vaddr, pa: Paddr, diff --git a/ostd/src/trap/irq.rs b/ostd/src/trap/irq.rs index 152d933f8..5d7b9a4b8 100644 --- a/ostd/src/trap/irq.rs +++ b/ostd/src/trap/irq.rs @@ -1,7 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] - use core::fmt::Debug; use crate::{