Remove useless #[allow(lint)]

This commit is contained in:
Ruihan Li 2025-01-24 17:39:58 +08:00 committed by Tate, Hongliang Tian
parent b42d596ec4
commit b415538097
32 changed files with 1 additions and 51 deletions

View File

@ -31,7 +31,6 @@
#![feature(fn_traits)] #![feature(fn_traits)]
#![feature(step_trait)] #![feature(step_trait)]
#![feature(trait_upcasting)] #![feature(trait_upcasting)]
#![allow(dead_code)]
extern crate alloc; extern crate alloc;

View File

@ -117,7 +117,6 @@ impl<'a> CurrentTx<'a> {
/// ///
/// In addition, the `get_current_mut_with` method must _not_ be called /// In addition, the `get_current_mut_with` method must _not_ be called
/// recursively. /// recursively.
#[allow(dropping_references)]
fn get_current_mut_with<F, R>(&self, f: F) -> R fn get_current_mut_with<F, R>(&self, f: F) -> R
where where
F: FnOnce(&mut Tx) -> R, F: FnOnce(&mut Tx) -> R,

View File

@ -60,7 +60,6 @@ pub struct Taskless {
/// The function that will be called when executing this taskless job. /// The function that will be called when executing this taskless job.
callback: Box<RefCell<dyn FnMut() + Send + Sync + 'static>>, callback: Box<RefCell<dyn FnMut() + Send + Sync + 'static>>,
/// Whether this `Taskless` is disabled. /// Whether this `Taskless` is disabled.
#[allow(unused)]
is_disabled: AtomicBool, is_disabled: AtomicBool,
link: LinkedListAtomicLink, link: LinkedListAtomicLink,
} }
@ -74,7 +73,6 @@ cpu_local! {
impl Taskless { impl Taskless {
/// Creates a new `Taskless` instance with its callback function. /// Creates a new `Taskless` instance with its callback function.
#[allow(unused)]
pub fn new<F>(callback: F) -> Arc<Self> pub fn new<F>(callback: F) -> Arc<Self>
where where
F: FnMut() + Send + Sync + 'static, F: FnMut() + Send + Sync + 'static,
@ -95,7 +93,6 @@ impl Taskless {
/// Schedules this taskless job and it will be executed in later time. /// Schedules this taskless job and it will be executed in later time.
/// ///
/// If the taskless job has been scheduled, this function will do nothing. /// If the taskless job has been scheduled, this function will do nothing.
#[allow(unused)]
pub fn schedule(self: &Arc<Self>) { pub fn schedule(self: &Arc<Self>) {
do_schedule(self, &TASKLESS_LIST); do_schedule(self, &TASKLESS_LIST);
SoftIrqLine::get(TASKLESS_SOFTIRQ_ID).raise(); SoftIrqLine::get(TASKLESS_SOFTIRQ_ID).raise();
@ -105,7 +102,6 @@ impl Taskless {
/// in softirq context. /// in softirq context.
/// ///
/// If the taskless job has been scheduled, this function will do nothing. /// If the taskless job has been scheduled, this function will do nothing.
#[allow(unused)]
pub fn schedule_urgent(self: &Arc<Self>) { pub fn schedule_urgent(self: &Arc<Self>) {
do_schedule(self, &TASKLESS_URGENT_LIST); do_schedule(self, &TASKLESS_URGENT_LIST);
SoftIrqLine::get(TASKLESS_URGENT_SOFTIRQ_ID).raise(); 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. /// Enables this `Taskless` so that it can be executed once it has been scheduled.
/// ///
/// A new `Taskless` is enabled by default. /// A new `Taskless` is enabled by default.
#[allow(unused)]
pub fn enable(&self) { pub fn enable(&self) {
self.is_disabled.store(false, Ordering::Release); self.is_disabled.store(false, Ordering::Release);
} }
/// Disables this `Taskless` so that it can not be scheduled. Note that if the `Taskless` /// 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. /// has been scheduled, it can still continue to complete this job.
#[allow(unused)]
pub fn disable(&self) { pub fn disable(&self) {
self.is_disabled.store(true, Ordering::Release); self.is_disabled.store(true, Ordering::Release);
} }
} }
#[allow(unused)]
fn do_schedule( fn do_schedule(
taskless: &Arc<Taskless>, taskless: &Arc<Taskless>,
taskless_list: &'static CpuLocal<RefCell<LinkedList<TasklessAdapter>>>, taskless_list: &'static CpuLocal<RefCell<LinkedList<TasklessAdapter>>>,

View File

@ -118,7 +118,6 @@ impl VirtioVsockHdr {
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, TryFromInt)] #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, TryFromInt)]
#[repr(u16)] #[repr(u16)]
#[allow(non_camel_case_types)]
pub enum VirtioVsockOp { pub enum VirtioVsockOp {
#[default] #[default]
Invalid = 0, Invalid = 0,

View File

@ -7,7 +7,6 @@ use ostd::mm::{DmaCoherent, DmaStream, DmaStreamSlice, HasDaddr};
/// ///
/// Any type implements this trait should also implements `HasDaddr` trait, /// Any type implements this trait should also implements `HasDaddr` trait,
/// and provides the exact length of DMA area. /// and provides the exact length of DMA area.
#[allow(clippy::len_without_is_empty)]
pub trait DmaBuf: HasDaddr { pub trait DmaBuf: HasDaddr {
/// The length of Dma area, in bytes /// The length of Dma area, in bytes
fn len(&self) -> usize; fn len(&self) -> usize;

View File

@ -73,7 +73,6 @@
//! ``` //! ```
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]
#![allow(dead_code)]
use require_item::RequireItem; use require_item::RequireItem;
use syn::parse_macro_input; use syn::parse_macro_input;

View File

@ -152,7 +152,6 @@ pub fn define_atomic_version_of_integer_like_type(input: TokenStream) -> TokenSt
} }
}; };
let fn_swap = quote! { let fn_swap = quote! {
#[allow(dead_code)]
pub fn swap( pub fn swap(
&self, &self,
val: impl Into<#integer_like_type>, 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! { let fn_compare_exchange = quote! {
#[allow(dead_code)]
pub fn compare_exchange( pub fn compare_exchange(
&self, &self,
current: impl Into<#integer_like_type>, 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! { let fn_fetch_update = quote! {
#[allow(dead_code)]
pub fn fetch_update<F>( pub fn fetch_update<F>(
&self, &self,
set_order: core::sync::atomic::Ordering, set_order: core::sync::atomic::Ordering,

View File

@ -3,7 +3,6 @@
//This crate defines the component system related macros. //This crate defines the component system related macros.
#![feature(proc_macro_diagnostic)] #![feature(proc_macro_diagnostic)]
#![allow(dead_code)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
mod init_comp; mod init_comp;

View File

@ -58,7 +58,6 @@ const EXFAT_UNUSED: u8 = 0x00;
#[allow(dead_code)] #[allow(dead_code)]
const EXFAT_INVAL: u8 = 0x80; const EXFAT_INVAL: u8 = 0x80;
const EXFAT_BITMAP: u8 = 0x81; const EXFAT_BITMAP: u8 = 0x81;
#[allow(dead_code)]
const EXFAT_UPCASE: u8 = 0x82; const EXFAT_UPCASE: u8 = 0x82;
#[allow(dead_code)] #[allow(dead_code)]
const EXFAT_VOLUME: u8 = 0x83; const EXFAT_VOLUME: u8 = 0x83;

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(unused_variables)]
use super::{inode::MAX_FNAME_LEN, prelude::*}; use super::{inode::MAX_FNAME_LEN, prelude::*};
/// The data structure in a directory's data block. It is stored in a linked list. /// The data structure in a directory's data block. It is stored in a linked list.

View File

@ -109,7 +109,6 @@ struct RamInode {
} }
/// Inode inner specifics. /// Inode inner specifics.
#[allow(clippy::large_enum_variant)]
enum Inner { enum Inner {
Dir(RwLock<DirEntry>), Dir(RwLock<DirEntry>),
File(PageCache), File(PageCache),

View File

@ -41,7 +41,6 @@ pub enum IpcControlCmd {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(dead_code)]
pub struct IpcPermission { pub struct IpcPermission {
key: key_t, key: key_t,
/// Owner's UID /// Owner's UID

View File

@ -1,5 +1,4 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(non_camel_case_types)]
use crate::{prelude::*, process::Pid}; use crate::{prelude::*, process::Pid};

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use aster_rights::{Dup, Read, TRights, Write}; use aster_rights::{Dup, Read, TRights, Write};
use aster_rights_proc::require; use aster_rights_proc::require;
use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard}; use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard};

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use core::sync::atomic::{AtomicU32, Ordering}; use core::sync::atomic::{AtomicU32, Ordering};
use aster_rights::{ReadOp, WriteOp}; use aster_rights::{ReadOp, WriteOp};

View File

@ -171,7 +171,6 @@ impl Process {
Some(Task::current()?.as_posix_thread()?.process()) Some(Task::current()?.as_posix_thread()?.process())
} }
#[allow(clippy::too_many_arguments)]
fn new( fn new(
pid: Pid, pid: Pid,
parent: Weak<Process>, parent: Weak<Process>,

View File

@ -1,7 +1,6 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables)]
//! This module is used to parse elf file content to get elf_load_info. //! 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 //! When create a process from elf file, we will use the elf_load_info to construct the VmSpace

View File

@ -21,7 +21,6 @@ use super::{
}; };
use crate::{prelude::*, thread::Thread}; use crate::{prelude::*, thread::Thread};
#[allow(unused)]
pub fn init() { pub fn init() {
let preempt_scheduler = Box::new(PreemptScheduler::default()); let preempt_scheduler = Box::new(PreemptScheduler::default());
let scheduler = Box::<PreemptScheduler<Thread, Task>>::leak(preempt_scheduler); let scheduler = Box::<PreemptScheduler<Thread, Task>>::leak(preempt_scheduler);

View File

@ -237,7 +237,6 @@ impl MMapOptions {
self.typ self.typ
} }
#[allow(unused)]
pub fn flags(&self) -> MMapFlags { pub fn flags(&self) -> MMapFlags {
self.flags self.flags
} }

View File

@ -75,7 +75,6 @@ fn set_new_stack(sig_stack_addr: Vaddr, old_stack: Option<&SigStack>, ctx: &Cont
Ok(()) Ok(())
} }
#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, Pod)] #[derive(Debug, Clone, Copy, Pod)]
#[repr(C)] #[repr(C)]
struct stack_t { struct stack_t {

View File

@ -13,7 +13,6 @@ use crate::{current_userspace, net::socket::SocketAddr, prelude::*};
#[repr(i32)] #[repr(i32)]
#[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[allow(dead_code)]
pub enum CSocketAddrFamily { pub enum CSocketAddrFamily {
AF_UNSPEC = 0, AF_UNSPEC = 0,
/// Unix domain sockets /// Unix domain sockets

View File

@ -46,10 +46,7 @@ where
let mut bytes: [u8; CSocketAddrUnix::MAX_LEN + 1] = Pod::new_zeroed(); let mut bytes: [u8; CSocketAddrUnix::MAX_LEN + 1] = Pod::new_zeroed();
bytes[..2].copy_from_slice(&(CSocketAddrFamily::AF_UNIX as u16).to_ne_bytes()); 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..]; let sun_path = &mut bytes[CSocketAddrUnix::PATH_OFFSET..];

View File

@ -36,7 +36,6 @@ where
} }
} }
#[allow(dead_code)]
impl<K, V> IntervalSet<K, V> impl<K, V> IntervalSet<K, V>
where where
K: Clone + Ord, K: Clone + Ord,

View File

@ -42,7 +42,6 @@ use crate::{
}; };
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
#[allow(dead_code)]
pub struct IommuVersion { pub struct IommuVersion {
major: u8, major: u8,
minor: u8, minor: u8,
@ -65,14 +64,12 @@ impl IommuVersion {
/// Important registers used by IOMMU. /// Important registers used by IOMMU.
#[derive(Debug)] #[derive(Debug)]
pub struct IommuRegisters { pub struct IommuRegisters {
#[allow(dead_code)]
version: Volatile<&'static u32, ReadOnly>, version: Volatile<&'static u32, ReadOnly>,
capability: Volatile<&'static u64, ReadOnly>, capability: Volatile<&'static u64, ReadOnly>,
extended_capability: Volatile<&'static u64, ReadOnly>, extended_capability: Volatile<&'static u64, ReadOnly>,
global_command: Volatile<&'static mut u32, WriteOnly>, global_command: Volatile<&'static mut u32, WriteOnly>,
global_status: Volatile<&'static u32, ReadOnly>, global_status: Volatile<&'static u32, ReadOnly>,
root_table_address: Volatile<&'static mut u64, ReadWrite>, root_table_address: Volatile<&'static mut u64, ReadWrite>,
#[allow(dead_code)]
context_command: Volatile<&'static mut u64, ReadWrite>, context_command: Volatile<&'static mut u64, ReadWrite>,
interrupt_remapping_table_addr: Volatile<&'static mut u64, ReadWrite>, interrupt_remapping_table_addr: Volatile<&'static mut u64, ReadWrite>,

View File

@ -85,7 +85,6 @@ pub unsafe fn init(on_bsp: bool) {
// The linker script ensure that cpu_local_tss section is right // The linker script ensure that cpu_local_tss section is right
// at the beginning of cpu_local area, so that gsbase (offset zero) // at the beginning of cpu_local area, so that gsbase (offset zero)
// points to LOCAL_TSS. // points to LOCAL_TSS.
#[allow(dead_code)]
#[link_section = ".cpu_local_tss"] #[link_section = ".cpu_local_tss"]
static LOCAL_TSS: SyncUnsafeCell<TaskStateSegment> = SyncUnsafeCell::new(TaskStateSegment::new()); static LOCAL_TSS: SyncUnsafeCell<TaskStateSegment> = SyncUnsafeCell::new(TaskStateSegment::new());

View File

@ -216,7 +216,6 @@ impl<T: 'static + SingleInstructionBitXorAssign<T>> CpuLocalCell<T> {
/// ///
/// Note that this memory operation will not be elided or reordered by the /// Note that this memory operation will not be elided or reordered by the
/// compiler since it is a black-box. /// compiler since it is a black-box.
#[allow(unused)]
pub fn bitxor_assign(&'static self, rhs: T) { pub fn bitxor_assign(&'static self, rhs: T) {
let offset = self as *const _ as usize - __cpu_local_start as usize; let offset = self as *const _ as usize - __cpu_local_start as usize;
// SAFETY: The CPU-local object is defined in the `.cpu_local` section, // SAFETY: The CPU-local object is defined in the `.cpu_local` section,

View File

@ -114,7 +114,6 @@ pub trait SingleInstructionBitXorAssign<Rhs = Self> {
/// # Safety /// # Safety
/// ///
/// Please refer to the module-level documentation of [`self`]. /// Please refer to the module-level documentation of [`self`].
#[allow(unused)]
unsafe fn bitxor_assign(offset: *mut Self, rhs: Rhs); unsafe fn bitxor_assign(offset: *mut Self, rhs: Rhs);
} }

View File

@ -210,7 +210,6 @@ impl<M: AnyFrameMeta + ?Sized> Frame<M> {
/// A physical address to the frame is returned in case the frame needs to be /// 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 /// 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. /// data structures need to hold the frame handle such as the page table.
#[allow(unused)]
pub(in crate::mm) fn into_raw(self) -> Paddr { pub(in crate::mm) fn into_raw(self) -> Paddr {
let paddr = self.start_paddr(); let paddr = self.start_paddr();
core::mem::forget(self); core::mem::forget(self);

View File

@ -258,7 +258,6 @@ impl Heap {
} }
/// Returns total memory size in bytes of the heap. /// Returns total memory size in bytes of the heap.
#[allow(unused)]
pub fn total_bytes(&self) -> usize { pub fn total_bytes(&self) -> usize {
self.slab_64_bytes.total_blocks() * 64 self.slab_64_bytes.total_blocks() * 64
+ self.slab_128_bytes.total_blocks() * 128 + self.slab_128_bytes.total_blocks() * 128
@ -271,7 +270,6 @@ impl Heap {
} }
/// Returns allocated memory size in bytes. /// Returns allocated memory size in bytes.
#[allow(unused)]
pub fn used_bytes(&self) -> usize { pub fn used_bytes(&self) -> usize {
self.slab_64_bytes.used_blocks() * 64 self.slab_64_bytes.used_blocks() * 64
+ self.slab_128_bytes.used_blocks() * 128 + self.slab_128_bytes.used_blocks() * 128

View File

@ -45,12 +45,10 @@ impl<const BLK_SIZE: usize> Slab<BLK_SIZE> {
} }
} }
#[allow(unused)]
pub fn total_blocks(&self) -> usize { pub fn total_blocks(&self) -> usize {
self.total_blocks self.total_blocks
} }
#[allow(unused)]
pub fn used_blocks(&self) -> usize { pub fn used_blocks(&self) -> usize {
self.total_blocks - self.free_block_list.len() self.total_blocks - self.free_block_list.len()
} }

View File

@ -94,7 +94,6 @@ pub enum PageTableItem {
page: Frame<dyn AnyFrameMeta>, page: Frame<dyn AnyFrameMeta>,
prop: PageProperty, prop: PageProperty,
}, },
#[allow(dead_code)]
MappedUntracked { MappedUntracked {
va: Vaddr, va: Vaddr,
pa: Paddr, pa: Paddr,

View File

@ -1,7 +1,5 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
#![allow(dead_code)]
use core::fmt::Debug; use core::fmt::Debug;
use crate::{ use crate::{