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(step_trait)]
#![feature(trait_upcasting)]
#![allow(dead_code)]
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
/// recursively.
#[allow(dropping_references)]
fn get_current_mut_with<F, R>(&self, f: F) -> R
where
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.
callback: Box<RefCell<dyn FnMut() + Send + Sync + 'static>>,
/// 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<F>(callback: F) -> Arc<Self>
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<Self>) {
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<Self>) {
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>,
taskless_list: &'static CpuLocal<RefCell<LinkedList<TasklessAdapter>>>,

View File

@ -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,

View File

@ -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;

View File

@ -73,7 +73,6 @@
//! ```
#![feature(proc_macro_diagnostic)]
#![allow(dead_code)]
use require_item::RequireItem;
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! {
#[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<F>(
&self,
set_order: core::sync::atomic::Ordering,

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

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

View File

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

View File

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

View File

@ -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};

View File

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

View File

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

View File

@ -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

View File

@ -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::<PreemptScheduler<Thread, Task>>::leak(preempt_scheduler);

View File

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

View File

@ -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 {

View File

@ -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

View File

@ -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..];

View File

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

View File

@ -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>,

View File

@ -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<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
/// 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,

View File

@ -114,7 +114,6 @@ pub trait SingleInstructionBitXorAssign<Rhs = Self> {
/// # Safety
///
/// Please refer to the module-level documentation of [`self`].
#[allow(unused)]
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
/// 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);

View File

@ -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

View File

@ -45,12 +45,10 @@ impl<const BLK_SIZE: usize> Slab<BLK_SIZE> {
}
}
#[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()
}

View File

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

View File

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