diff --git a/kernel/comps/framebuffer/src/lib.rs b/kernel/comps/framebuffer/src/lib.rs index 90d146a4c..5bcea971c 100644 --- a/kernel/comps/framebuffer/src/lib.rs +++ b/kernel/comps/framebuffer/src/lib.rs @@ -31,9 +31,9 @@ fn framebuffer_init() -> Result<(), ComponentInitError> { pub(crate) static WRITER: Once> = Once::new(); // ignore the warnings since we use the `todo!` macro. -#[allow(unused_variables)] -#[allow(unreachable_code)] -#[allow(clippy::diverging_sub_expression)] +#[expect(unused_variables)] +#[expect(unreachable_code)] +#[expect(clippy::diverging_sub_expression)] pub(crate) fn init() { let mut writer = { let Some(framebuffer) = boot_info().framebuffer_arg else { diff --git a/kernel/comps/mlsdisk/src/lib.rs b/kernel/comps/mlsdisk/src/lib.rs index d430dffd6..30499e508 100644 --- a/kernel/comps/mlsdisk/src/lib.rs +++ b/kernel/comps/mlsdisk/src/lib.rs @@ -5,7 +5,7 @@ #![feature(let_chains)] #![feature(negative_impls)] #![feature(slice_as_chunks)] -#![allow(dead_code, unused_imports)] +#![expect(dead_code, unused_imports)] mod error; mod layers; diff --git a/kernel/comps/mlsdisk/src/tx/mod.rs b/kernel/comps/mlsdisk/src/tx/mod.rs index 335f64667..bbcafae88 100644 --- a/kernel/comps/mlsdisk/src/tx/mod.rs +++ b/kernel/comps/mlsdisk/src/tx/mod.rs @@ -21,7 +21,7 @@ use crate::{ }; /// A transaction provider. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub struct TxProvider { id: u64, initializer_map: RwLock>>, diff --git a/kernel/comps/mlsdisk/src/util/lazy_delete.rs b/kernel/comps/mlsdisk/src/util/lazy_delete.rs index 79a0c1941..f15fdcd8a 100644 --- a/kernel/comps/mlsdisk/src/util/lazy_delete.rs +++ b/kernel/comps/mlsdisk/src/util/lazy_delete.rs @@ -40,7 +40,7 @@ use crate::prelude::*; /// // The deletion operation will be carried out when it is dropped /// drop(lazy_delete_u32); /// ``` -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] pub struct LazyDelete { obj: T, is_deleted: AtomicBool, diff --git a/kernel/comps/network/src/dma_pool.rs b/kernel/comps/network/src/dma_pool.rs index fe34ac5e9..f17144008 100644 --- a/kernel/comps/network/src/dma_pool.rs +++ b/kernel/comps/network/src/dma_pool.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused)] +#![expect(unused)] use alloc::{ collections::VecDeque, diff --git a/kernel/comps/softirq/src/taskless.rs b/kernel/comps/softirq/src/taskless.rs index 8c067f4c7..15d27dd0e 100644 --- a/kernel/comps/softirq/src/taskless.rs +++ b/kernel/comps/softirq/src/taskless.rs @@ -80,7 +80,7 @@ impl Taskless { // Since the same taskless will not be executed concurrently, // it is safe to use a `RefCell` here though the `Taskless` will // be put into an `Arc`. - #[allow(clippy::arc_with_non_send_sync)] + #[expect(clippy::arc_with_non_send_sync)] Arc::new(Self { is_scheduled: AtomicBool::new(false), is_running: AtomicBool::new(false), diff --git a/kernel/comps/virtio/src/device/input/device.rs b/kernel/comps/virtio/src/device/input/device.rs index 971fbf692..fa555794e 100644 --- a/kernel/comps/virtio/src/device/input/device.rs +++ b/kernel/comps/virtio/src/device/input/device.rs @@ -75,7 +75,7 @@ pub struct InputDevice { event_queue: SpinLock, status_queue: VirtQueue, event_table: EventTable, - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] callbacks: RwLock>, LocalIrqDisabled>, transport: SpinLock>, } diff --git a/kernel/comps/virtio/src/device/network/header.rs b/kernel/comps/virtio/src/device/network/header.rs index ca888a8cd..11afe508b 100644 --- a/kernel/comps/virtio/src/device/network/header.rs +++ b/kernel/comps/virtio/src/device/network/header.rs @@ -34,7 +34,7 @@ bitflags! { #[repr(u8)] #[derive(Default, Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum GsoType { #[default] VIRTIO_NET_HDR_GSO_NONE = 0, diff --git a/kernel/comps/virtio/src/transport/pci/capability.rs b/kernel/comps/virtio/src/transport/pci/capability.rs index 4fb4866b1..a41737079 100644 --- a/kernel/comps/virtio/src/transport/pci/capability.rs +++ b/kernel/comps/virtio/src/transport/pci/capability.rs @@ -11,7 +11,7 @@ use ostd::bus::pci::{ #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] #[repr(u8)] -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] pub enum VirtioPciCpabilityType { CommonCfg = 1, NotifyCfg = 2, diff --git a/kernel/comps/virtio/src/transport/pci/device.rs b/kernel/comps/virtio/src/transport/pci/device.rs index 05798d84b..a3cddd810 100644 --- a/kernel/comps/virtio/src/transport/pci/device.rs +++ b/kernel/comps/virtio/src/transport/pci/device.rs @@ -268,7 +268,7 @@ impl VirtioTransport for VirtioPciModernTransport { } impl VirtioPciModernTransport { - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] pub(super) fn new( common_device: PciCommonDevice, ) -> Result { diff --git a/kernel/comps/virtio/src/transport/pci/legacy.rs b/kernel/comps/virtio/src/transport/pci/legacy.rs index 9fa1cab7e..5cc0908e5 100644 --- a/kernel/comps/virtio/src/transport/pci/legacy.rs +++ b/kernel/comps/virtio/src/transport/pci/legacy.rs @@ -73,7 +73,7 @@ pub struct VirtioPciLegacyTransport { impl VirtioPciLegacyTransport { pub const QUEUE_ALIGN_SIZE: usize = 4096; - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] pub(super) fn new( common_device: PciCommonDevice, ) -> Result { diff --git a/kernel/libs/aster-bigtcp/src/iface/mod.rs b/kernel/libs/aster-bigtcp/src/iface/mod.rs index 428d7a438..e5f8c8ed8 100644 --- a/kernel/libs/aster-bigtcp/src/iface/mod.rs +++ b/kernel/libs/aster-bigtcp/src/iface/mod.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 mod common; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod iface; mod phy; mod poll; diff --git a/kernel/libs/aster-rights-proc/src/require_attr.rs b/kernel/libs/aster-rights-proc/src/require_attr.rs index ced40f68c..a9c3dbcfa 100644 --- a/kernel/libs/aster-rights-proc/src/require_attr.rs +++ b/kernel/libs/aster-rights-proc/src/require_attr.rs @@ -70,14 +70,14 @@ pub fn expand_require(item: RequireItem, mut require_attr: RequireAttr) -> Token RequireItem::Impl(item_impl) => { let new_item_impl = require_attr.fold_item_impl(item_impl); quote!( - #[allow(clippy::multiple_bound_locations)] + #[expect(clippy::multiple_bound_locations)] #new_item_impl ) } RequireItem::Fn(item_fn) => { let new_item_fn = require_attr.fold_item_fn(item_fn); quote!( - #[allow(clippy::multiple_bound_locations)] + #[expect(clippy::multiple_bound_locations)] #new_item_fn ) } diff --git a/kernel/libs/comp-sys/cargo-component/src/driver.rs b/kernel/libs/comp-sys/cargo-component/src/driver.rs index 43bc66f0d..6a3a39381 100644 --- a/kernel/libs/comp-sys/cargo-component/src/driver.rs +++ b/kernel/libs/comp-sys/cargo-component/src/driver.rs @@ -80,7 +80,7 @@ impl rustc_driver::Callbacks for DefaultCallbacks {} struct ComponentCallbacks; impl rustc_driver::Callbacks for ComponentCallbacks { // JUSTIFICATION: necessary to set `mir_opt_level` - #[allow(rustc::bad_opt_access)] + #[expect(rustc::bad_opt_access)] fn config(&mut self, config: &mut interface::Config) { let conf_path = analysis::lookup_conf_file(); let conf_path_string = if let Ok(Some(path)) = &conf_path { @@ -179,7 +179,7 @@ fn report_ice(info: &panic::PanicInfo<'_>) { interface::try_print_query_stack(&handler, num_frames); } -#[allow(clippy::too_many_lines)] +#[expect(clippy::too_many_lines)] pub fn main() { rustc_driver::init_rustc_env_logger(); LazyLock::force(&ICE_HOOK); diff --git a/kernel/libs/comp-sys/cargo-component/tests/test_utils/mod.rs b/kernel/libs/comp-sys/cargo-component/tests/test_utils/mod.rs index 3724d455e..3a0cfe6e8 100644 --- a/kernel/libs/comp-sys/cargo-component/tests/test_utils/mod.rs +++ b/kernel/libs/comp-sys/cargo-component/tests/test_utils/mod.rs @@ -1,7 +1,7 @@ // Licensed under the Apache License, Version 2.0 or the MIT License. // Copyright (C) 2023-2024 Ant Group. -#![allow(unused)] +#![expect(unused)] use std::path::PathBuf; use std::process::Command; diff --git a/kernel/libs/keyable-arc/src/lib.rs b/kernel/libs/keyable-arc/src/lib.rs index ea24d11b4..34b0702ab 100644 --- a/kernel/libs/keyable-arc/src/lib.rs +++ b/kernel/libs/keyable-arc/src/lib.rs @@ -248,7 +248,7 @@ impl KeyableWeak { /// Constructs a new `KeyableWeak`, without allocating any memory. /// Calling `upgrade` on the return value always gives `None`. #[inline] - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Self(Weak::new()) } diff --git a/kernel/libs/typeflags-util/src/set.rs b/kernel/libs/typeflags-util/src/set.rs index 42cb01ea8..b2b0a894e 100644 --- a/kernel/libs/typeflags-util/src/set.rs +++ b/kernel/libs/typeflags-util/src/set.rs @@ -17,7 +17,7 @@ pub trait Set {} pub struct Cons(PhantomData<(T, S)>); impl Cons { - #[allow(clippy::new_without_default)] + #[expect(clippy::new_without_default)] pub fn new() -> Self { Cons(PhantomData) } diff --git a/kernel/src/device/null.rs b/kernel/src/device/null.rs index 8ab3b5b61..8dc61c121 100644 --- a/kernel/src/device/null.rs +++ b/kernel/src/device/null.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use super::*; use crate::{ diff --git a/kernel/src/device/pty/mod.rs b/kernel/src/device/pty/mod.rs index 0faf80f84..67f21b71c 100644 --- a/kernel/src/device/pty/mod.rs +++ b/kernel/src/device/pty/mod.rs @@ -10,7 +10,7 @@ use crate::{ prelude::*, }; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod pty; pub use pty::{PtyMaster, PtySlave}; diff --git a/kernel/src/device/random.rs b/kernel/src/device/random.rs index 2f04c1df9..ec8416e42 100644 --- a/kernel/src/device/random.rs +++ b/kernel/src/device/random.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use crate::{ events::IoEvents, diff --git a/kernel/src/device/tty/device.rs b/kernel/src/device/tty/device.rs index 05bb15805..27cc06140 100644 --- a/kernel/src/device/tty/device.rs +++ b/kernel/src/device/tty/device.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use crate::{ events::IoEvents, diff --git a/kernel/src/device/tty/driver.rs b/kernel/src/device/tty/driver.rs index 5c510cc35..0534ce5be 100644 --- a/kernel/src/device/tty/driver.rs +++ b/kernel/src/device/tty/driver.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use ostd::mm::{Infallible, VmReader}; use spin::Once; diff --git a/kernel/src/device/tty/line_discipline.rs b/kernel/src/device/tty/line_discipline.rs index 30020d513..937ca7518 100644 --- a/kernel/src/device/tty/line_discipline.rs +++ b/kernel/src/device/tty/line_discipline.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use alloc::format; diff --git a/kernel/src/device/tty/mod.rs b/kernel/src/device/tty/mod.rs index 72215c460..0849a23ca 100644 --- a/kernel/src/device/tty/mod.rs +++ b/kernel/src/device/tty/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use ostd::early_print; use spin::Once; diff --git a/kernel/src/device/tty/termio.rs b/kernel/src/device/tty/termio.rs index 77dd8e43d..9412cccc6 100644 --- a/kernel/src/device/tty/termio.rs +++ b/kernel/src/device/tty/termio.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(non_camel_case_types)] +#![expect(dead_code)] +#![expect(non_camel_case_types)] use crate::prelude::*; diff --git a/kernel/src/device/urandom.rs b/kernel/src/device/urandom.rs index faace7a71..57817e26d 100644 --- a/kernel/src/device/urandom.rs +++ b/kernel/src/device/urandom.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use crate::{ events::IoEvents, diff --git a/kernel/src/device/zero.rs b/kernel/src/device/zero.rs index 8319d5b31..8299137ce 100644 --- a/kernel/src/device/zero.rs +++ b/kernel/src/device/zero.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use super::*; use crate::{ diff --git a/kernel/src/error.rs b/kernel/src/error.rs index 0a8949f14..62372e7c1 100644 --- a/kernel/src/error.rs +++ b/kernel/src/error.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] /// Error number. #[repr(i32)] diff --git a/kernel/src/events/mod.rs b/kernel/src/events/mod.rs index ef6b8b09a..86151976c 100644 --- a/kernel/src/events/mod.rs +++ b/kernel/src/events/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod events; mod io_events; mod observer; diff --git a/kernel/src/events/observer.rs b/kernel/src/events/observer.rs index 0c098bfd1..49af13291 100644 --- a/kernel/src/events/observer.rs +++ b/kernel/src/events/observer.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use super::Events; diff --git a/kernel/src/fs/devpts/mod.rs b/kernel/src/fs/devpts/mod.rs index 9b36487d8..622fb922a 100644 --- a/kernel/src/fs/devpts/mod.rs +++ b/kernel/src/fs/devpts/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::time::Duration; diff --git a/kernel/src/fs/devpts/ptmx.rs b/kernel/src/fs/devpts/ptmx.rs index de9a74ed7..6a549afb1 100644 --- a/kernel/src/fs/devpts/ptmx.rs +++ b/kernel/src/fs/devpts/ptmx.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use super::*; use crate::{ diff --git a/kernel/src/fs/devpts/slave.rs b/kernel/src/fs/devpts/slave.rs index 1df3b8d86..444751f4d 100644 --- a/kernel/src/fs/devpts/slave.rs +++ b/kernel/src/fs/devpts/slave.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use super::*; use crate::{ diff --git a/kernel/src/fs/exfat/bitmap.rs b/kernel/src/fs/exfat/bitmap.rs index 412c3abaf..01d51183e 100644 --- a/kernel/src/fs/exfat/bitmap.rs +++ b/kernel/src/fs/exfat/bitmap.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use core::ops::Range; diff --git a/kernel/src/fs/exfat/constants.rs b/kernel/src/fs/exfat/constants.rs index f4e8a4b99..9956c2001 100644 --- a/kernel/src/fs/exfat/constants.rs +++ b/kernel/src/fs/exfat/constants.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] pub(super) const ROOT_INODE_HASH: usize = 0; // Other pub(super) constants diff --git a/kernel/src/fs/exfat/dentry.rs b/kernel/src/fs/exfat/dentry.rs index 46be20764..02f9f61e2 100644 --- a/kernel/src/fs/exfat/dentry.rs +++ b/kernel/src/fs/exfat/dentry.rs @@ -55,24 +55,24 @@ impl ExfatDentry { const EXFAT_UNUSED: u8 = 0x00; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_INVAL: u8 = 0x80; const EXFAT_BITMAP: u8 = 0x81; const EXFAT_UPCASE: u8 = 0x82; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_VOLUME: u8 = 0x83; const EXFAT_FILE: u8 = 0x85; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_GUID: u8 = 0xA0; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_PADDING: u8 = 0xA1; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_ACLTAB: u8 = 0xA2; const EXFAT_STREAM: u8 = 0xC0; const EXFAT_NAME: u8 = 0xC1; -#[allow(dead_code)] +#[expect(dead_code)] const EXFAT_ACL: u8 = 0xC2; const EXFAT_VENDOR_EXT: u8 = 0xE0; @@ -204,7 +204,7 @@ impl ExfatDentrySet { /// Stream dentry index. const ES_IDX_STREAM: usize = 1; /// Name dentry index. - #[allow(dead_code)] + #[expect(dead_code)] const ES_IDX_FIRST_FILENAME: usize = 2; pub(super) fn new(dentries: Vec, should_checksum_match: bool) -> Result { diff --git a/kernel/src/fs/exfat/fs.rs b/kernel/src/fs/exfat/fs.rs index 3ceafbac9..5ee93486c 100644 --- a/kernel/src/fs/exfat/fs.rs +++ b/kernel/src/fs/exfat/fs.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use core::{num::NonZeroUsize, ops::Range, sync::atomic::AtomicU64}; diff --git a/kernel/src/fs/exfat/inode.rs b/kernel/src/fs/exfat/inode.rs index 80b1c95d6..976ee3696 100644 --- a/kernel/src/fs/exfat/inode.rs +++ b/kernel/src/fs/exfat/inode.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::string::String; use core::{cmp::Ordering, time::Duration}; @@ -491,7 +491,7 @@ impl ExfatInodeInner { }; // FIXME: This isn't expected by the compiler. - #[allow(non_local_definitions)] + #[expect(non_local_definitions)] impl DirentVisitor for Vec<(String, usize)> { fn visit( &mut self, @@ -1011,7 +1011,7 @@ impl ExfatInode { let sub_dir = inner.num_sub_inodes; let mut child_offsets: Vec = vec![]; // FIXME: This isn't expected by the compiler. - #[allow(non_local_definitions)] + #[expect(non_local_definitions)] impl DirentVisitor for Vec { fn visit( &mut self, diff --git a/kernel/src/fs/exfat/upcase_table.rs b/kernel/src/fs/exfat/upcase_table.rs index 587535bdf..1b72845c5 100644 --- a/kernel/src/fs/exfat/upcase_table.rs +++ b/kernel/src/fs/exfat/upcase_table.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use align_ext::AlignExt; use aster_rights::Full; diff --git a/kernel/src/fs/ext2/fs.rs b/kernel/src/fs/ext2/fs.rs index 4c9bd9c42..f09e722e6 100644 --- a/kernel/src/fs/ext2/fs.rs +++ b/kernel/src/fs/ext2/fs.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::{ block_group::{BlockGroup, RawGroupDescriptor}, diff --git a/kernel/src/fs/ext2/impl_for_vfs/inode.rs b/kernel/src/fs/ext2/impl_for_vfs/inode.rs index 084527efe..a639f7060 100644 --- a/kernel/src/fs/ext2/impl_for_vfs/inode.rs +++ b/kernel/src/fs/ext2/impl_for_vfs/inode.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::time::Duration; diff --git a/kernel/src/fs/ext2/inode.rs b/kernel/src/fs/ext2/inode.rs index 8fcba61a9..2d5ed3872 100644 --- a/kernel/src/fs/ext2/inode.rs +++ b/kernel/src/fs/ext2/inode.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::{borrow::ToOwned, rc::Rc}; use core::sync::atomic::{AtomicUsize, Ordering}; diff --git a/kernel/src/fs/file_handle.rs b/kernel/src/fs/file_handle.rs index 8bbf42f17..11f298994 100644 --- a/kernel/src/fs/file_handle.rs +++ b/kernel/src/fs/file_handle.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] //! Opened File Handle diff --git a/kernel/src/fs/file_table.rs b/kernel/src/fs/file_table.rs index cd3f34738..fbd3c2a24 100644 --- a/kernel/src/fs/file_table.rs +++ b/kernel/src/fs/file_table.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::sync::atomic::{AtomicU8, Ordering}; diff --git a/kernel/src/fs/fs_resolver.rs b/kernel/src/fs/fs_resolver.rs index c9d8fc304..803f58f30 100644 --- a/kernel/src/fs/fs_resolver.rs +++ b/kernel/src/fs/fs_resolver.rs @@ -195,7 +195,7 @@ impl FsResolver { /// If `follow_tail_link` is true and the trailing component is a symlink, /// it will be followed. /// Symlinks in earlier components of the path will always be followed. - #[allow(clippy::redundant_closure)] + #[expect(clippy::redundant_closure)] fn lookup_from_parent( &self, parent: &Dentry, diff --git a/kernel/src/fs/inode_handle/mod.rs b/kernel/src/fs/inode_handle/mod.rs index 2ab99a4c5..bb5ab724d 100644 --- a/kernel/src/fs/inode_handle/mod.rs +++ b/kernel/src/fs/inode_handle/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] //! Opened Inode-backed File Handle diff --git a/kernel/src/fs/path/dentry.rs b/kernel/src/fs/path/dentry.rs index aad59db5a..17193aa20 100644 --- a/kernel/src/fs/path/dentry.rs +++ b/kernel/src/fs/path/dentry.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use core::{ sync::atomic::{AtomicU32, Ordering}, diff --git a/kernel/src/fs/procfs/template/builder.rs b/kernel/src/fs/procfs/template/builder.rs index 0d85ae87f..9bda8241d 100644 --- a/kernel/src/fs/procfs/template/builder.rs +++ b/kernel/src/fs/procfs/template/builder.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::{ dir::{DirOps, ProcDir}, @@ -166,7 +166,7 @@ impl OptionalBuilder { self } - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] pub fn build( self, ) -> Result<( diff --git a/kernel/src/fs/procfs/template/dir.rs b/kernel/src/fs/procfs/template/dir.rs index db42c15b7..344ba694a 100644 --- a/kernel/src/fs/procfs/template/dir.rs +++ b/kernel/src/fs/procfs/template/dir.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::time::Duration; diff --git a/kernel/src/fs/utils/access_mode.rs b/kernel/src/fs/utils/access_mode.rs index 6186858e9..0d7bd0e26 100644 --- a/kernel/src/fs/utils/access_mode.rs +++ b/kernel/src/fs/utils/access_mode.rs @@ -4,7 +4,7 @@ use aster_rights::Rights; use crate::prelude::*; -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Clone, Copy, Debug)] #[repr(u8)] pub enum AccessMode { diff --git a/kernel/src/fs/utils/dirent_visitor.rs b/kernel/src/fs/utils/dirent_visitor.rs index b0d4a118d..7a33d22b9 100644 --- a/kernel/src/fs/utils/dirent_visitor.rs +++ b/kernel/src/fs/utils/dirent_visitor.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use super::InodeType; use crate::prelude::*; diff --git a/kernel/src/fs/utils/inode.rs b/kernel/src/fs/utils/inode.rs index 45b9bc03e..f68d84f05 100644 --- a/kernel/src/fs/utils/inode.rs +++ b/kernel/src/fs/utils/inode.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::{any::TypeId, time::Duration}; diff --git a/kernel/src/fs/utils/page_cache.rs b/kernel/src/fs/utils/page_cache.rs index 990f27323..da719bd69 100644 --- a/kernel/src/fs/utils/page_cache.rs +++ b/kernel/src/fs/utils/page_cache.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use core::{ iter, diff --git a/kernel/src/fs/utils/random_test.rs b/kernel/src/fs/utils/random_test.rs index e7c921445..f7bf9f7e4 100644 --- a/kernel/src/fs/utils/random_test.rs +++ b/kernel/src/fs/utils/random_test.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use alloc::sync::Arc; diff --git a/kernel/src/ipc/mod.rs b/kernel/src/ipc/mod.rs index af39a4267..8e02c5115 100644 --- a/kernel/src/ipc/mod.rs +++ b/kernel/src/ipc/mod.rs @@ -7,7 +7,7 @@ use crate::{ pub mod semaphore; -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub type key_t = i32; bitflags! { @@ -25,7 +25,7 @@ bitflags! { #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum IpcControlCmd { IPC_RMID = 0, IPC_SET = 1, diff --git a/kernel/src/kcmdline.rs b/kernel/src/kcmdline.rs index a4adaa3a7..049f54569 100644 --- a/kernel/src/kcmdline.rs +++ b/kernel/src/kcmdline.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] //! The module to parse kernel command-line arguments. //! diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 7e4698036..df471aeb5 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -6,7 +6,7 @@ #![no_std] #![no_main] #![deny(unsafe_code)] -#![allow(incomplete_features)] +#![expect(incomplete_features)] #![feature(btree_cursors)] #![feature(btree_extract_if)] #![feature(debug_closure_helpers)] diff --git a/kernel/src/net/socket/util/shutdown_cmd.rs b/kernel/src/net/socket/util/shutdown_cmd.rs index 47a5b3378..8b694a338 100644 --- a/kernel/src/net/socket/util/shutdown_cmd.rs +++ b/kernel/src/net/socket/util/shutdown_cmd.rs @@ -6,7 +6,7 @@ use crate::prelude::*; /// From #[repr(i32)] #[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum SockShutdownCmd { /// Shutdown receptions SHUT_RD = 0, diff --git a/kernel/src/prelude.rs b/kernel/src/prelude.rs index c5e52471c..fada40038 100644 --- a/kernel/src/prelude.rs +++ b/kernel/src/prelude.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused)] +#![expect(unused)] pub(crate) use alloc::{ boxed::Box, diff --git a/kernel/src/process/mod.rs b/kernel/src/process/mod.rs index bbb4b51a8..faa15c6a1 100644 --- a/kernel/src/process/mod.rs +++ b/kernel/src/process/mod.rs @@ -5,7 +5,7 @@ pub mod credentials; mod exit; mod kill; pub mod posix_thread; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod process; mod process_filter; pub mod process_table; diff --git a/kernel/src/process/posix_thread/builder.rs b/kernel/src/process/posix_thread/builder.rs index 61399905a..32fabc32c 100644 --- a/kernel/src/process/posix_thread/builder.rs +++ b/kernel/src/process/posix_thread/builder.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use ostd::{cpu::CpuSet, sync::RwArc, task::Task, user::UserSpace}; diff --git a/kernel/src/process/posix_thread/futex.rs b/kernel/src/process/posix_thread/futex.rs index f79858f4c..01dc543bc 100644 --- a/kernel/src/process/posix_thread/futex.rs +++ b/kernel/src/process/posix_thread/futex.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use intrusive_collections::{intrusive_adapter, LinkedList, LinkedListAtomicLink}; use ostd::{ @@ -382,7 +382,7 @@ impl FutexKey { // The implementation is from occlum #[derive(PartialEq, Debug, Clone, Copy)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum FutexOp { FUTEX_WAIT = 0, FUTEX_WAKE = 1, diff --git a/kernel/src/process/process/builder.rs b/kernel/src/process/process/builder.rs index 8f6848194..9e4227641 100644 --- a/kernel/src/process/process/builder.rs +++ b/kernel/src/process/process/builder.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::{Pid, Process}; use crate::{ diff --git a/kernel/src/process/process/job_control.rs b/kernel/src/process/process/job_control.rs index 5226cb5c0..1395b5af1 100644 --- a/kernel/src/process/process/job_control.rs +++ b/kernel/src/process/process/job_control.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use ostd::sync::WaitQueue; diff --git a/kernel/src/process/process_filter.rs b/kernel/src/process/process_filter.rs index 9a8887741..f33886cd4 100644 --- a/kernel/src/process/process_filter.rs +++ b/kernel/src/process/process_filter.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::{Pgid, Pid}; use crate::prelude::*; diff --git a/kernel/src/process/process_table.rs b/kernel/src/process/process_table.rs index 526703ff1..6bf19efbe 100644 --- a/kernel/src/process/process_table.rs +++ b/kernel/src/process/process_table.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! A global table stores the pid to process mapping. //! This table can be used to get process with pid. diff --git a/kernel/src/process/process_vm/init_stack/aux_vec.rs b/kernel/src/process/process_vm/init_stack/aux_vec.rs index b117bc48e..bec2f04d2 100644 --- a/kernel/src/process/process_vm/init_stack/aux_vec.rs +++ b/kernel/src/process/process_vm/init_stack/aux_vec.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use crate::prelude::*; @@ -14,7 +14,7 @@ use crate::prelude::*; /// > about the environment in which it is operating. The form of this information /// > is a table of key-value pairs, where the keys are from the set of ‘AT_’ /// > values in elf.h. -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] #[repr(u8)] pub enum AuxKey { diff --git a/kernel/src/process/process_vm/init_stack/mod.rs b/kernel/src/process/process_vm/init_stack/mod.rs index 1dc2b26a1..884786846 100644 --- a/kernel/src/process/process_vm/init_stack/mod.rs +++ b/kernel/src/process/process_vm/init_stack/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! The init stack for the process. //! The init stack is used to store the `argv` and `envp` and auxiliary vectors. diff --git a/kernel/src/process/program_loader/elf/elf_file.rs b/kernel/src/process/program_loader/elf/elf_file.rs index a3afcdb7e..0cf2b3628 100644 --- a/kernel/src/process/program_loader/elf/elf_file.rs +++ b/kernel/src/process/program_loader/elf/elf_file.rs @@ -165,23 +165,23 @@ impl ElfHeader { pub struct HeaderPt2_64 { pub type_: Type_, pub machine: Machine_, - #[allow(dead_code)] + #[expect(dead_code)] pub version: u32, pub entry_point: u64, pub ph_offset: u64, - #[allow(dead_code)] + #[expect(dead_code)] pub sh_offset: u64, - #[allow(dead_code)] + #[expect(dead_code)] pub flags: u32, - #[allow(dead_code)] + #[expect(dead_code)] pub header_size: u16, pub ph_entry_size: u16, pub ph_count: u16, - #[allow(dead_code)] + #[expect(dead_code)] pub sh_entry_size: u16, - #[allow(dead_code)] + #[expect(dead_code)] pub sh_count: u16, - #[allow(dead_code)] + #[expect(dead_code)] pub sh_str_index: u16, } diff --git a/kernel/src/process/program_loader/elf/load_elf.rs b/kernel/src/process/program_loader/elf/load_elf.rs index 8b9ae1ead..34c087ab0 100644 --- a/kernel/src/process/program_loader/elf/load_elf.rs +++ b/kernel/src/process/program_loader/elf/load_elf.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! 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/process/rlimit.rs b/kernel/src/process/rlimit.rs index 978d7a089..9dac343a4 100644 --- a/kernel/src/process/rlimit.rs +++ b/kernel/src/process/rlimit.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 // FIXME: The resource limits should be respected by the corresponding subsystems of the kernel. -#![allow(non_camel_case_types)] +#![expect(non_camel_case_types)] use super::process_vm::{INIT_STACK_SIZE, USER_HEAP_SIZE_LIMIT}; use crate::prelude::*; diff --git a/kernel/src/process/signal/c_types.rs b/kernel/src/process/signal/c_types.rs index 5981cd165..e2e2afe82 100644 --- a/kernel/src/process/signal/c_types.rs +++ b/kernel/src/process/signal/c_types.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(non_camel_case_types)] +#![expect(dead_code)] +#![expect(non_camel_case_types)] use core::mem::{self, size_of}; diff --git a/kernel/src/process/signal/constants.rs b/kernel/src/process/signal/constants.rs index d0640fc31..737142404 100644 --- a/kernel/src/process/signal/constants.rs +++ b/kernel/src/process/signal/constants.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] /// Standard signals pub(super) const MIN_STD_SIG_NUM: u8 = 1; diff --git a/kernel/src/process/signal/mod.rs b/kernel/src/process/signal/mod.rs index 54a007a31..0bd4b270b 100644 --- a/kernel/src/process/signal/mod.rs +++ b/kernel/src/process/signal/mod.rs @@ -135,7 +135,7 @@ pub fn handle_pending_signal( } } -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub fn handle_user_signal( ctx: &Context, sig_num: SigNum, diff --git a/kernel/src/process/signal/sig_mask.rs b/kernel/src/process/signal/sig_mask.rs index 332d0fd47..d3fd99cfb 100644 --- a/kernel/src/process/signal/sig_mask.rs +++ b/kernel/src/process/signal/sig_mask.rs @@ -84,7 +84,7 @@ impl> ops::BitOrAssign for SigSet { } } -#[allow(clippy::suspicious_arithmetic_impl)] +#[expect(clippy::suspicious_arithmetic_impl)] impl> ops::Add for SigSet { type Output = Self; @@ -95,7 +95,7 @@ impl> ops::Add for SigSet { } } -#[allow(clippy::suspicious_op_assign_impl)] +#[expect(clippy::suspicious_op_assign_impl)] impl> ops::AddAssign for SigSet { fn add_assign(&mut self, rhs: T) { self.bits |= rhs.into().bits; diff --git a/kernel/src/process/signal/sig_num.rs b/kernel/src/process/signal/sig_num.rs index 74dbab3f5..085c22613 100644 --- a/kernel/src/process/signal/sig_num.rs +++ b/kernel/src/process/signal/sig_num.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use core::sync::atomic::{AtomicU8, Ordering}; diff --git a/kernel/src/process/signal/sig_stack.rs b/kernel/src/process/signal/sig_stack.rs index e98e332f7..722560000 100644 --- a/kernel/src/process/signal/sig_stack.rs +++ b/kernel/src/process/signal/sig_stack.rs @@ -25,7 +25,7 @@ bitflags! { } #[repr(u8)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] pub enum SigStackStatus { #[default] diff --git a/kernel/src/process/signal/signals/user.rs b/kernel/src/process/signal/signals/user.rs index 1016cbef8..2445d10cd 100644 --- a/kernel/src/process/signal/signals/user.rs +++ b/kernel/src/process/signal/signals/user.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::Signal; use crate::process::{ diff --git a/kernel/src/process/sync/condvar.rs b/kernel/src/process/sync/condvar.rs index c28fa52dd..3ad638ad5 100644 --- a/kernel/src/process/sync/condvar.rs +++ b/kernel/src/process/sync/condvar.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::sync::Arc; use core::time::Duration; diff --git a/kernel/src/process/sync/mod.rs b/kernel/src/process/sync/mod.rs index e00126916..3724f7f0b 100644 --- a/kernel/src/process/sync/mod.rs +++ b/kernel/src/process/sync/mod.rs @@ -2,5 +2,5 @@ mod condvar; -#[allow(unused_imports)] +#[expect(unused_imports)] pub use self::condvar::{Condvar, LockErr}; diff --git a/kernel/src/process/wait.rs b/kernel/src/process/wait.rs index bd0922631..f95f16545 100644 --- a/kernel/src/process/wait.rs +++ b/kernel/src/process/wait.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use super::{process_filter::ProcessFilter, signal::constants::SIGCHLD, ExitCode, Pid, Process}; use crate::{ diff --git a/kernel/src/sched/sched_class/fair.rs b/kernel/src/sched/sched_class/fair.rs index a274225ce..1d7fce86b 100644 --- a/kernel/src/sched/sched_class/fair.rs +++ b/kernel/src/sched/sched_class/fair.rs @@ -165,7 +165,7 @@ impl Ord for FairQueueItem { /// ensure the efficiency for finding next-to-run threads. #[derive(Debug)] pub(super) struct FairClassRq { - #[allow(unused)] + #[expect(unused)] cpu: CpuId, /// The ready-to-run threads. entities: BinaryHeap>, diff --git a/kernel/src/sched/sched_class/mod.rs b/kernel/src/sched/sched_class/mod.rs index a35253aae..15d241212 100644 --- a/kernel/src/sched/sched_class/mod.rs +++ b/kernel/src/sched/sched_class/mod.rs @@ -38,7 +38,7 @@ use crate::thread::{AsThread, Thread}; type SchedEntity = (Arc, Arc); -#[allow(unused)] +#[expect(unused)] pub fn init() { inject_scheduler(Box::leak(Box::new(ClassScheduler::new()))); } diff --git a/kernel/src/sched/sched_class/real_time.rs b/kernel/src/sched/sched_class/real_time.rs index 9e2bf6c8a..c446485d1 100644 --- a/kernel/src/sched/sched_class/real_time.rs +++ b/kernel/src/sched/sched_class/real_time.rs @@ -135,7 +135,7 @@ impl PrioArray { /// is empty, the 2 arrays are swapped by `index`. #[derive(Debug)] pub(super) struct RealTimeClassRq { - #[allow(unused)] + #[expect(unused)] cpu: CpuId, index: bool, array: [PrioArray; 2], diff --git a/kernel/src/syscall/arch_prctl.rs b/kernel/src/syscall/arch_prctl.rs index 72d1d387e..041de4874 100644 --- a/kernel/src/syscall/arch_prctl.rs +++ b/kernel/src/syscall/arch_prctl.rs @@ -5,7 +5,7 @@ use ostd::cpu::UserContext; use super::SyscallReturn; use crate::prelude::*; -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[repr(u64)] #[derive(Debug, TryFromInt)] pub enum ArchPrctlCode { diff --git a/kernel/src/syscall/clock_gettime.rs b/kernel/src/syscall/clock_gettime.rs index c7412d28b..08859482e 100644 --- a/kernel/src/syscall/clock_gettime.rs +++ b/kernel/src/syscall/clock_gettime.rs @@ -39,7 +39,7 @@ pub fn sys_clock_gettime( // The hard-coded clock IDs. #[derive(Debug, Copy, Clone, TryFromInt, PartialEq)] #[repr(i32)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum ClockId { CLOCK_REALTIME = 0, CLOCK_MONOTONIC = 1, @@ -68,7 +68,7 @@ pub enum ClockId { pub enum DynamicClockIdInfo { Pid(u32, DynamicClockType), Tid(u32, DynamicClockType), - #[allow(dead_code)] + #[expect(dead_code)] Fd(u32), } diff --git a/kernel/src/syscall/fcntl.rs b/kernel/src/syscall/fcntl.rs index 6a23fa6a3..0d30b3464 100644 --- a/kernel/src/syscall/fcntl.rs +++ b/kernel/src/syscall/fcntl.rs @@ -161,7 +161,7 @@ fn handle_setown(fd: FileDesc, arg: u64, ctx: &Context) -> Result #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] enum FcntlCmd { F_DUPFD = 0, F_GETFD = 1, @@ -176,10 +176,10 @@ enum FcntlCmd { F_DUPFD_CLOEXEC = 1030, } -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub type off_t = i64; -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Debug, Copy, Clone, TryFromInt)] #[repr(u16)] pub enum RangeLockWhence { diff --git a/kernel/src/syscall/getdents64.rs b/kernel/src/syscall/getdents64.rs index eeb1e1771..58096ed9b 100644 --- a/kernel/src/syscall/getdents64.rs +++ b/kernel/src/syscall/getdents64.rs @@ -229,11 +229,11 @@ impl DirentSerializer for Dirent64 { } } -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[repr(u8)] #[derive(Debug, Clone, Copy)] enum DirentType { - #[allow(dead_code)] + #[expect(dead_code)] DT_UNKNOWN = 0, DT_FIFO = 1, DT_CHR = 2, @@ -242,7 +242,7 @@ enum DirentType { DT_REG = 8, DT_LNK = 10, DT_SOCK = 12, - #[allow(dead_code)] + #[expect(dead_code)] DT_WHT = 14, } diff --git a/kernel/src/syscall/madvise.rs b/kernel/src/syscall/madvise.rs index 5de02d9e0..c7506e97c 100644 --- a/kernel/src/syscall/madvise.rs +++ b/kernel/src/syscall/madvise.rs @@ -60,7 +60,7 @@ fn madv_free(start: Vaddr, end: Vaddr, ctx: &Context) -> Result<()> { #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] /// This definition is the same from linux pub enum MadviseBehavior { MADV_NORMAL = 0, /* no further special treatment */ diff --git a/kernel/src/syscall/prctl.rs b/kernel/src/syscall/prctl.rs index ac6667fb5..72d14b93a 100644 --- a/kernel/src/syscall/prctl.rs +++ b/kernel/src/syscall/prctl.rs @@ -96,7 +96,7 @@ const PR_GET_NAME: i32 = 16; const PR_SET_TIMERSLACK: i32 = 29; const PR_GET_TIMERSLACK: i32 = 30; -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Debug, Clone, Copy)] pub enum PrctlCmd { PR_SET_PDEATHSIG(SigNum), @@ -105,9 +105,9 @@ pub enum PrctlCmd { PR_GET_NAME(Vaddr), PR_GET_KEEPCAPS, PR_SET_KEEPCAPS(u32), - #[allow(dead_code)] + #[expect(dead_code)] PR_SET_TIMERSLACK(u64), - #[allow(dead_code)] + #[expect(dead_code)] PR_GET_TIMERSLACK, PR_SET_DUMPABLE(Dumpable), PR_GET_DUMPABLE, diff --git a/kernel/src/syscall/select.rs b/kernel/src/syscall/select.rs index d70408730..d709a6ce2 100644 --- a/kernel/src/syscall/select.rs +++ b/kernel/src/syscall/select.rs @@ -219,7 +219,7 @@ impl FdSet { } /// Equivalent to FD_CLR. - #[allow(unused)] + #[expect(unused)] pub fn unset(&mut self, fd: FileDesc) -> Result<()> { let fd = fd as usize; if fd >= FD_SETSIZE { diff --git a/kernel/src/syscall/set_get_priority.rs b/kernel/src/syscall/set_get_priority.rs index 5dc7e8054..c585a1c0f 100644 --- a/kernel/src/syscall/set_get_priority.rs +++ b/kernel/src/syscall/set_get_priority.rs @@ -126,7 +126,7 @@ impl PriorityTarget { } } -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Clone, Debug, TryFromInt)] #[repr(i32)] enum Which { diff --git a/kernel/src/syscall/setitimer.rs b/kernel/src/syscall/setitimer.rs index 9efc539c9..6e7c7dab8 100644 --- a/kernel/src/syscall/setitimer.rs +++ b/kernel/src/syscall/setitimer.rs @@ -11,7 +11,7 @@ use crate::{ /// `ItimerType` is used to differ the target timer for some timer-related syscalls. #[derive(Debug, Copy, Clone, TryFromInt, PartialEq)] #[repr(i32)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub(super) enum ItimerType { ITIMER_REAL = 0, ITIMER_VIRTUAL = 1, diff --git a/kernel/src/syscall/sigaltstack.rs b/kernel/src/syscall/sigaltstack.rs index f679c9341..de4d7a1b1 100644 --- a/kernel/src/syscall/sigaltstack.rs +++ b/kernel/src/syscall/sigaltstack.rs @@ -126,6 +126,6 @@ impl From for stack_t { } } -#[allow(unused)] +#[expect(unused)] const SIGSTKSZ: usize = 8192; const MINSTKSZ: usize = 2048; diff --git a/kernel/src/thread/exception.rs b/kernel/src/thread/exception.rs index 465eb8691..472dc1bf2 100644 --- a/kernel/src/thread/exception.rs +++ b/kernel/src/thread/exception.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use aster_rights::Full; use ostd::{cpu::*, mm::VmSpace}; diff --git a/kernel/src/thread/work_queue/mod.rs b/kernel/src/thread/work_queue/mod.rs index a0b818542..ed2c18b65 100644 --- a/kernel/src/thread/work_queue/mod.rs +++ b/kernel/src/thread/work_queue/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! Work queue mechanism. //! diff --git a/kernel/src/thread/work_queue/work_item.rs b/kernel/src/thread/work_queue/work_item.rs index 36a7c94c1..53e8f5700 100644 --- a/kernel/src/thread/work_queue/work_item.rs +++ b/kernel/src/thread/work_queue/work_item.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use core::sync::atomic::{AtomicBool, Ordering}; diff --git a/kernel/src/thread/work_queue/worker.rs b/kernel/src/thread/work_queue/worker.rs index d68aa18e3..0de1bdaeb 100644 --- a/kernel/src/thread/work_queue/worker.rs +++ b/kernel/src/thread/work_queue/worker.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use ostd::{ cpu::{CpuId, CpuSet}, diff --git a/kernel/src/thread/work_queue/worker_pool.rs b/kernel/src/thread/work_queue/worker_pool.rs index 33677b79a..2e4963164 100644 --- a/kernel/src/thread/work_queue/worker_pool.rs +++ b/kernel/src/thread/work_queue/worker_pool.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use core::{ sync::atomic::{AtomicBool, Ordering}, diff --git a/kernel/src/time/mod.rs b/kernel/src/time/mod.rs index 18b09ed3c..896c58ec2 100644 --- a/kernel/src/time/mod.rs +++ b/kernel/src/time/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(non_camel_case_types)] +#![expect(non_camel_case_types)] pub use core::{timer, Clock}; diff --git a/kernel/src/util/net/addr/family.rs b/kernel/src/util/net/addr/family.rs index 6fe92c443..4af9a1b21 100644 --- a/kernel/src/util/net/addr/family.rs +++ b/kernel/src/util/net/addr/family.rs @@ -12,7 +12,7 @@ use crate::{current_userspace, net::socket::SocketAddr, prelude::*}; /// See . #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum CSocketAddrFamily { AF_UNSPEC = 0, /// Unix domain sockets diff --git a/kernel/src/util/net/options/mod.rs b/kernel/src/util/net/options/mod.rs index 75a6e360a..796e9829c 100644 --- a/kernel/src/util/net/options/mod.rs +++ b/kernel/src/util/net/options/mod.rs @@ -141,7 +141,7 @@ pub fn new_raw_socket_option( /// Sock Opt level. The definition is from https://elixir.bootlin.com/linux/v6.0.9/source/include/linux/socket.h#L343 #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum CSocketOptionLevel { SOL_IP = 0, SOL_SOCKET = 1, diff --git a/kernel/src/util/net/options/socket.rs b/kernel/src/util/net/options/socket.rs index be486a3af..131ac2863 100644 --- a/kernel/src/util/net/options/socket.rs +++ b/kernel/src/util/net/options/socket.rs @@ -14,8 +14,8 @@ use crate::{ /// The definition is from https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/asm-generic/socket.h. #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt, PartialEq, Eq, PartialOrd, Ord)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] +#[expect(non_camel_case_types)] +#[expect(clippy::upper_case_acronyms)] enum CSocketOptionName { DEBUG = 1, REUSEADDR = 2, diff --git a/kernel/src/util/net/options/tcp.rs b/kernel/src/util/net/options/tcp.rs index 283b615ec..9c0b6491c 100644 --- a/kernel/src/util/net/options/tcp.rs +++ b/kernel/src/util/net/options/tcp.rs @@ -13,8 +13,8 @@ use crate::{ /// The raw definition is from https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/linux/tcp.h#L92 #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] +#[expect(non_camel_case_types)] +#[expect(clippy::upper_case_acronyms)] pub enum CTcpOptionName { NODELAY = 1, /* Turn off Nagle's algorithm. */ MAXSEG = 2, /* Limit MSS */ diff --git a/kernel/src/util/net/socket.rs b/kernel/src/util/net/socket.rs index ecd26122d..e1990adcb 100644 --- a/kernel/src/util/net/socket.rs +++ b/kernel/src/util/net/socket.rs @@ -11,7 +11,7 @@ use crate::{ /// From https://elixir.bootlin.com/linux/v6.0.9/source/include/uapi/linux/in.h. #[repr(i32)] #[derive(Debug, Clone, Copy, TryFromInt)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] pub enum Protocol { IPPROTO_IP = 0, /* Dummy protocol for TCP */ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ @@ -44,7 +44,7 @@ pub enum Protocol { /// Socket types. /// From https://elixir.bootlin.com/linux/v6.0.9/source/include/linux/net.h #[repr(i32)] -#[allow(non_camel_case_types)] +#[expect(non_camel_case_types)] #[derive(Debug, Clone, Copy, TryFromInt)] pub enum SockType { /// Stream socket diff --git a/kernel/src/util/random.rs b/kernel/src/util/random.rs index 349a58625..8a23e96b0 100644 --- a/kernel/src/util/random.rs +++ b/kernel/src/util/random.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use rand::{rngs::StdRng, Error as RandError, RngCore}; use spin::Once; diff --git a/kernel/src/util/ring_buffer.rs b/kernel/src/util/ring_buffer.rs index e42d41bed..398bae8c3 100644 --- a/kernel/src/util/ring_buffer.rs +++ b/kernel/src/util/ring_buffer.rs @@ -224,7 +224,7 @@ impl RingBuffer { /// Writes data from the `reader` to the `RingBuffer`. /// /// Returns the number of bytes written. - #[allow(unused)] + #[expect(unused)] pub fn write_fallible(&mut self, reader: &mut dyn MultiRead) -> Result { let mut producer = Producer { rb: self, diff --git a/kernel/src/vdso.rs b/kernel/src/vdso.rs index f79d1ea0b..7ad4cb9c9 100644 --- a/kernel/src/vdso.rs +++ b/kernel/src/vdso.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] //! The Virtual Dynamic Shared Object (VDSO) module enables user space applications to access kernel space routines //! without the need for context switching. This is particularly useful for frequently invoked operations such as diff --git a/kernel/src/vm/vmo/mod.rs b/kernel/src/vm/vmo/mod.rs index ee5724f74..77c94dc0b 100644 --- a/kernel/src/vm/vmo/mod.rs +++ b/kernel/src/vm/vmo/mod.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] //! Virtual Memory Objects (VMOs). diff --git a/kernel/src/vm/vmo/options.rs b/kernel/src/vm/vmo/options.rs index 8795d6fc3..c77306292 100644 --- a/kernel/src/vm/vmo/options.rs +++ b/kernel/src/vm/vmo/options.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] //! Options for allocating root and child VMOs. diff --git a/osdk/src/config/manifest.rs b/osdk/src/config/manifest.rs index 5e6836eed..7c941c76e 100644 --- a/osdk/src/config/manifest.rs +++ b/osdk/src/config/manifest.rs @@ -32,7 +32,7 @@ pub enum ProjectType { /// The osdk manifest from configuration file `OSDK.toml`. #[derive(Debug, Clone)] pub struct TomlManifest { - #[allow(dead_code)] + #[expect(dead_code)] pub project_type: Option, pub default_scheme: Scheme, pub map: HashMap, diff --git a/osdk/test-kernel/src/path.rs b/osdk/test-kernel/src/path.rs index d018a8a82..d795ea240 100644 --- a/osdk/test-kernel/src/path.rs +++ b/osdk/test-kernel/src/path.rs @@ -46,7 +46,7 @@ impl KtestPath { self.path.pop_back() } - #[allow(dead_code)] + #[expect(dead_code)] pub fn push_front(&mut self, s: &str) { self.path.push_front(PathElement::from(s)) } @@ -55,7 +55,7 @@ impl KtestPath { self.path.pop_front() } - #[allow(dead_code)] + #[expect(dead_code)] pub fn len(&self) -> usize { self.path.len() } diff --git a/osdk/test-kernel/src/tree.rs b/osdk/test-kernel/src/tree.rs index d5d6813cd..1aa644b7e 100644 --- a/osdk/test-kernel/src/tree.rs +++ b/osdk/test-kernel/src/tree.rs @@ -28,7 +28,7 @@ pub struct KtestModule { } impl KtestModule { - #[allow(dead_code)] + #[expect(dead_code)] pub fn nr_this_tests(&self) -> usize { self.tests.len() } diff --git a/ostd/libs/linux-bzimage/builder/src/pe_header.rs b/ostd/libs/linux-bzimage/builder/src/pe_header.rs index 3f4e73e0b..4c6271c2a 100644 --- a/ostd/libs/linux-bzimage/builder/src/pe_header.rs +++ b/ostd/libs/linux-bzimage/builder/src/pe_header.rs @@ -167,7 +167,7 @@ bitflags::bitflags! { // The `flags` field choices in the PE section header. // We follow the Linux naming, thus ignoring the clippy name warnings. -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] #[derive(Serialize, Clone, Copy)] #[repr(u32)] enum PeSectionHdrFlagsAlign { diff --git a/ostd/libs/linux-bzimage/setup/src/console.rs b/ostd/libs/linux-bzimage/setup/src/console.rs index 1af8b88ee..638a76505 100644 --- a/ostd/libs/linux-bzimage/setup/src/console.rs +++ b/ostd/libs/linux-bzimage/setup/src/console.rs @@ -41,7 +41,7 @@ impl Write for Stdout { /// /// [`init()`] must be called before it and there should be no race conditions. pub unsafe fn print_str(s: &str) { - #[allow(static_mut_refs)] + #[expect(static_mut_refs)] STDOUT.write_str(s).unwrap(); } @@ -53,7 +53,7 @@ pub unsafe fn print_str(s: &str) { /// /// [`init()`] must be called before it and there should be no race conditions. unsafe fn print_char(c: char) { - #[allow(static_mut_refs)] + #[expect(static_mut_refs)] STDOUT.serial_port.send(c as u8); } diff --git a/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs index a01fd7a6a..dc1428b3c 100644 --- a/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs +++ b/ostd/libs/linux-bzimage/setup/src/x86/amd64_efi/efi.rs @@ -18,9 +18,9 @@ use super::{ const PAGE_SIZE: u64 = 4096; // Suppress warnings since using todo!. -#[allow(unreachable_code)] -#[allow(unused_variables)] -#[allow(clippy::diverging_sub_expression)] +#[expect(unreachable_code)] +#[expect(unused_variables)] +#[expect(clippy::diverging_sub_expression)] #[export_name = "efi_stub_entry"] extern "sysv64" fn efi_stub_entry(handle: Handle, system_table: *const SystemTable) -> ! { // SAFETY: handle and system_table are valid pointers. It is only called once. diff --git a/ostd/libs/ostd-macros/src/lib.rs b/ostd/libs/ostd-macros/src/lib.rs index ad733aa8d..4456a6e3d 100644 --- a/ostd/libs/ostd-macros/src/lib.rs +++ b/ostd/libs/ostd-macros/src/lib.rs @@ -36,7 +36,7 @@ pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream { unreachable!("`yield_now` in the boot context should not return"); } - #[allow(unused)] + #[expect(unused)] #main_fn ) .into() @@ -82,7 +82,7 @@ pub fn panic_handler(_attr: TokenStream, item: TokenStream) -> TokenStream { #handler_fn_name(info); } - #[allow(unused)] + #[expect(unused)] #handler_fn ) .into() diff --git a/ostd/src/arch/riscv/irq.rs b/ostd/src/arch/riscv/irq.rs index b476c59a4..978e0e7e6 100644 --- a/ostd/src/arch/riscv/irq.rs +++ b/ostd/src/arch/riscv/irq.rs @@ -78,7 +78,7 @@ impl IrqLine { /// /// This function is marked unsafe as manipulating interrupt lines is /// considered a dangerous operation. - #[allow(clippy::redundant_allocation)] + #[expect(clippy::redundant_allocation)] pub unsafe fn acquire(irq_num: u8) -> Arc<&'static Self> { Arc::new(IRQ_LIST.get().unwrap().get(irq_num as usize).unwrap()) } diff --git a/ostd/src/arch/riscv/trap/trap.rs b/ostd/src/arch/riscv/trap/trap.rs index 6520997c0..df52625d3 100644 --- a/ostd/src/arch/riscv/trap/trap.rs +++ b/ostd/src/arch/riscv/trap/trap.rs @@ -129,7 +129,7 @@ impl UserContext { /// General registers #[derive(Debug, Default, Clone, Copy, Pod)] #[repr(C)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub struct GeneralRegs { pub zero: usize, pub ra: usize, @@ -214,7 +214,7 @@ impl UserContext { } } -#[allow(improper_ctypes)] +#[expect(improper_ctypes)] extern "C" { fn trap_entry(); fn run_user(regs: &mut UserContext); diff --git a/ostd/src/arch/x86/cpu/mod.rs b/ostd/src/arch/x86/cpu/mod.rs index 50d9e1632..d96c598eb 100644 --- a/ostd/src/arch/x86/cpu/mod.rs +++ b/ostd/src/arch/x86/cpu/mod.rs @@ -247,7 +247,7 @@ impl CpuExceptionType { macro_rules! define_cpu_exception { ( $([ $name: ident = $exception_id:tt, $exception_type:tt]),* ) => { /// CPU exception. - #[allow(non_camel_case_types)] + #[expect(non_camel_case_types)] #[derive(Debug, Copy, Clone, Eq, PartialEq, FromPrimitive)] pub enum CpuException { $( diff --git a/ostd/src/arch/x86/device/cmos.rs b/ostd/src/arch/x86/device/cmos.rs index 1fedda482..6aab22e57 100644 --- a/ostd/src/arch/x86/device/cmos.rs +++ b/ostd/src/arch/x86/device/cmos.rs @@ -7,7 +7,7 @@ //! Reference: //! -#![allow(unused_variables)] +#![expect(unused_variables)] use acpi::fadt::Fadt; use x86_64::instructions::port::{ReadOnlyAccess, WriteOnlyAccess}; diff --git a/ostd/src/arch/x86/device/serial.rs b/ostd/src/arch/x86/device/serial.rs index fc5d8f847..2fa15c723 100644 --- a/ostd/src/arch/x86/device/serial.rs +++ b/ostd/src/arch/x86/device/serial.rs @@ -2,7 +2,7 @@ //! A port-mapped UART. Copied from uart_16550. -#![allow(dead_code)] +#![expect(dead_code)] use crate::arch::x86::device::io_port::{IoPort, ReadWriteAccess, WriteOnlyAccess}; diff --git a/ostd/src/arch/x86/iommu/dma_remapping/context_table.rs b/ostd/src/arch/x86/iommu/dma_remapping/context_table.rs index d0caf484e..cb02f22d8 100644 --- a/ostd/src/arch/x86/iommu/dma_remapping/context_table.rs +++ b/ostd/src/arch/x86/iommu/dma_remapping/context_table.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::collections::BTreeMap; use core::mem::size_of; diff --git a/ostd/src/arch/x86/iommu/dma_remapping/second_stage.rs b/ostd/src/arch/x86/iommu/dma_remapping/second_stage.rs index d2800e630..a17b482bc 100644 --- a/ostd/src/arch/x86/iommu/dma_remapping/second_stage.rs +++ b/ostd/src/arch/x86/iommu/dma_remapping/second_stage.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::ops::Range; diff --git a/ostd/src/arch/x86/iommu/fault.rs b/ostd/src/arch/x86/iommu/fault.rs index 4095f05bb..bec06a42c 100644 --- a/ostd/src/arch/x86/iommu/fault.rs +++ b/ostd/src/arch/x86/iommu/fault.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::vec::Vec; use core::fmt::Debug; @@ -176,7 +176,7 @@ pub enum FaultRequestType { #[derive(Debug)] #[repr(u8)] -#[allow(clippy::enum_variant_names)] +#[expect(clippy::enum_variant_names)] pub enum FaultAddressType { UntranslatedRequest = 0, TranslationRequest = 1, diff --git a/ostd/src/arch/x86/iommu/interrupt_remapping/mod.rs b/ostd/src/arch/x86/iommu/interrupt_remapping/mod.rs index 25425551f..6bcc6cff3 100644 --- a/ostd/src/arch/x86/iommu/interrupt_remapping/mod.rs +++ b/ostd/src/arch/x86/iommu/interrupt_remapping/mod.rs @@ -26,7 +26,7 @@ impl IrtEntryHandle { self.index } - #[allow(unused)] + #[expect(unused)] pub fn irt_entry(&self) -> Option<&IrtEntry> { self.entry_ref.as_deref() } diff --git a/ostd/src/arch/x86/iommu/interrupt_remapping/table.rs b/ostd/src/arch/x86/iommu/interrupt_remapping/table.rs index e26374f5c..7094b8bc6 100644 --- a/ostd/src/arch/x86/iommu/interrupt_remapping/table.rs +++ b/ostd/src/arch/x86/iommu/interrupt_remapping/table.rs @@ -13,7 +13,7 @@ use crate::{ sync::{LocalIrqDisabled, SpinLock}, }; -#[allow(dead_code)] +#[expect(dead_code)] #[derive(Debug)] enum ExtendedInterruptMode { XApic, @@ -146,12 +146,12 @@ enum DeliveryMode { pub struct IrtEntry(u128); impl IrtEntry { - #[allow(unused)] + #[expect(unused)] pub const fn new(value: u128) -> Self { Self(value) } - #[allow(unused)] + #[expect(unused)] pub fn clear(&mut self) { self.0 = 0 } diff --git a/ostd/src/arch/x86/iommu/registers/mod.rs b/ostd/src/arch/x86/iommu/registers/mod.rs index 432e8170d..d6dc245c1 100644 --- a/ostd/src/arch/x86/iommu/registers/mod.rs +++ b/ostd/src/arch/x86/iommu/registers/mod.rs @@ -49,13 +49,13 @@ pub struct IommuVersion { impl IommuVersion { /// Major version number - #[allow(dead_code)] + #[expect(dead_code)] pub fn major(&self) -> u8 { self.major } /// Minor version number - #[allow(dead_code)] + #[expect(dead_code)] pub fn minor(&self) -> u8 { self.minor } @@ -79,7 +79,7 @@ pub struct IommuRegisters { impl IommuRegisters { /// Reads the version of IOMMU - #[allow(dead_code)] + #[expect(dead_code)] pub fn read_version(&self) -> IommuVersion { let version = self.version.read(); IommuVersion { diff --git a/ostd/src/arch/x86/irq.rs b/ostd/src/arch/x86/irq.rs index 030ae14d7..5cf81b6d5 100644 --- a/ostd/src/arch/x86/irq.rs +++ b/ostd/src/arch/x86/irq.rs @@ -2,7 +2,7 @@ //! Interrupts. -#![allow(dead_code)] +#![expect(dead_code)] use alloc::{boxed::Box, fmt::Debug, sync::Arc, vec::Vec}; @@ -98,7 +98,7 @@ impl IrqLine { /// /// This function is marked unsafe as manipulating interrupt lines is /// considered a dangerous operation. - #[allow(clippy::redundant_allocation)] + #[expect(clippy::redundant_allocation)] pub unsafe fn acquire(irq_num: u8) -> Arc<&'static Self> { let irq = Arc::new(IRQ_LIST.get().unwrap().get(irq_num as usize).unwrap()); if has_interrupt_remapping() { diff --git a/ostd/src/arch/x86/kernel/acpi/dmar.rs b/ostd/src/arch/x86/kernel/acpi/dmar.rs index 16849b005..ad22e1383 100644 --- a/ostd/src/arch/x86/kernel/acpi/dmar.rs +++ b/ostd/src/arch/x86/kernel/acpi/dmar.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::vec::Vec; use core::{fmt::Debug, mem::size_of, slice::Iter}; @@ -37,7 +37,7 @@ pub enum Remapping { #[derive(Debug, Clone, Copy)] #[repr(u16)] -#[allow(clippy::upper_case_acronyms)] +#[expect(clippy::upper_case_acronyms)] pub enum RemappingType { DRHD = 0, RMRR = 1, diff --git a/ostd/src/arch/x86/kernel/acpi/mod.rs b/ostd/src/arch/x86/kernel/acpi/mod.rs index 1e763f74f..0d4886096 100644 --- a/ostd/src/arch/x86/kernel/acpi/mod.rs +++ b/ostd/src/arch/x86/kernel/acpi/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] pub mod dmar; pub mod remapping; diff --git a/ostd/src/arch/x86/kernel/acpi/remapping.rs b/ostd/src/arch/x86/kernel/acpi/remapping.rs index b80776d22..2a0a4c523 100644 --- a/ostd/src/arch/x86/kernel/acpi/remapping.rs +++ b/ostd/src/arch/x86/kernel/acpi/remapping.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] //! Remapping structures of DMAR table. //! This file defines these structures and provides a "Debug" implementation to see the value inside these structures. diff --git a/ostd/src/arch/x86/kernel/apic/ioapic.rs b/ostd/src/arch/x86/kernel/apic/ioapic.rs index 1fe83ce45..db64db120 100644 --- a/ostd/src/arch/x86/kernel/apic/ioapic.rs +++ b/ostd/src/arch/x86/kernel/apic/ioapic.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::{vec, vec::Vec}; diff --git a/ostd/src/arch/x86/kernel/apic/mod.rs b/ostd/src/arch/x86/kernel/apic/mod.rs index 06fefec33..e71cb98f5 100644 --- a/ostd/src/arch/x86/kernel/apic/mod.rs +++ b/ostd/src/arch/x86/kernel/apic/mod.rs @@ -167,7 +167,7 @@ enum ApicType { pub struct Icr(u64); impl Icr { - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn new( destination: ApicId, destination_shorthand: DestinationShorthand, @@ -217,7 +217,7 @@ impl ApicId { /// In x2APIC mode, the 32-bit logical x2APIC ID, which can be read from /// LDR, is derived from the 32-bit local x2APIC ID: /// Logical x2APIC ID = [(x2APIC ID[19:4] << 16) | (1 << x2APIC ID[3:0])] - #[allow(unused)] + #[expect(unused)] pub fn x2apic_logical_id(&self) -> u32 { self.x2apic_logical_cluster_id() << 16 | 1 << self.x2apic_logical_field_id() } @@ -267,7 +267,7 @@ impl From for ApicId { #[repr(u64)] pub enum DestinationShorthand { NoShorthand = 0b00, - #[allow(dead_code)] + #[expect(dead_code)] MySelf = 0b01, AllIncludingSelf = 0b10, AllExcludingSelf = 0b11, @@ -291,14 +291,14 @@ pub enum Level { #[repr(u64)] pub enum DeliveryStatus { Idle = 0, - #[allow(dead_code)] + #[expect(dead_code)] SendPending = 1, } #[repr(u64)] pub enum DestinationMode { Physical = 0, - #[allow(dead_code)] + #[expect(dead_code)] Logical = 1, } @@ -310,14 +310,14 @@ pub enum DeliveryMode { /// the lowest priority among the set of processors specified in the destination field. The /// ability for a processor to send a lowest priority IPI is model specific and should be /// avoided by BIOS and operating system software. - #[allow(dead_code)] + #[expect(dead_code)] LowestPriority = 0b001, /// Non-Maskable Interrupt - #[allow(dead_code)] + #[expect(dead_code)] Smi = 0b010, _Reserved = 0b011, /// System Management Interrupt - #[allow(dead_code)] + #[expect(dead_code)] Nmi = 0b100, /// Delivers an INIT request to the target processor or processors, which causes them to /// perform an initialization. @@ -334,7 +334,7 @@ pub enum ApicInitError { #[derive(Debug)] #[repr(u32)] -#[allow(dead_code)] +#[expect(dead_code)] pub enum DivideConfig { Divide1 = 0b1011, Divide2 = 0b0000, diff --git a/ostd/src/arch/x86/kernel/apic/xapic.rs b/ostd/src/arch/x86/kernel/apic/xapic.rs index 2655699fe..6d55124c9 100644 --- a/ostd/src/arch/x86/kernel/apic/xapic.rs +++ b/ostd/src/arch/x86/kernel/apic/xapic.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use x86::apic::xapic; diff --git a/ostd/src/arch/x86/kernel/pic.rs b/ostd/src/arch/x86/kernel/pic.rs index bd54f914e..4a2804ef1 100644 --- a/ostd/src/arch/x86/kernel/pic.rs +++ b/ostd/src/arch/x86/kernel/pic.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use core::sync::atomic::{AtomicBool, AtomicU8, Ordering::Relaxed}; diff --git a/ostd/src/arch/x86/kernel/tsc.rs b/ostd/src/arch/x86/kernel/tsc.rs index cb991a859..fbffbedc8 100644 --- a/ostd/src/arch/x86/kernel/tsc.rs +++ b/ostd/src/arch/x86/kernel/tsc.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use core::{ arch::x86_64::_rdtsc, diff --git a/ostd/src/arch/x86/mm/mod.rs b/ostd/src/arch/x86/mm/mod.rs index 480c835d0..8be0f71b1 100644 --- a/ostd/src/arch/x86/mm/mod.rs +++ b/ostd/src/arch/x86/mm/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::fmt; use core::ops::Range; diff --git a/ostd/src/arch/x86/serial.rs b/ostd/src/arch/x86/serial.rs index d72a7fe3d..ebcf29b5f 100644 --- a/ostd/src/arch/x86/serial.rs +++ b/ostd/src/arch/x86/serial.rs @@ -2,8 +2,8 @@ //! The console I/O. -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::{fmt, sync::Arc, vec::Vec}; use core::fmt::Write; diff --git a/ostd/src/arch/x86/timer/apic.rs b/ostd/src/arch/x86/timer/apic.rs index 8a7b8f356..e04a6304f 100644 --- a/ostd/src/arch/x86/timer/apic.rs +++ b/ostd/src/arch/x86/timer/apic.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(unused_variables)] +#![expect(unused_variables)] use alloc::sync::Arc; use core::{ diff --git a/ostd/src/arch/x86/timer/hpet.rs b/ostd/src/arch/x86/timer/hpet.rs index 9bea9d6f6..51235a259 100644 --- a/ostd/src/arch/x86/timer/hpet.rs +++ b/ostd/src/arch/x86/timer/hpet.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::vec::Vec; diff --git a/ostd/src/arch/x86/timer/pit.rs b/ostd/src/arch/x86/timer/pit.rs index e16c00298..d451eb5e3 100644 --- a/ostd/src/arch/x86/timer/pit.rs +++ b/ostd/src/arch/x86/timer/pit.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! The Programmable Interval Timer (PIT) chip (Intel 8253/8254) basically consists of an oscillator, //! a prescaler and 3 independent frequency dividers. Each frequency divider has an output, which is @@ -143,13 +143,13 @@ static CHANNEL0_PORT: IoPort = unsafe { IoPort::new(0x40) } /// /// On later machines, the DRAM refresh is done with dedicated hardware and this channel /// is no longer used. -#[allow(unused)] +#[expect(unused)] static CHANNEL1_PORT: IoPort = unsafe { IoPort::new(0x41) }; /// The output from PIT channel 2 is connected to the PC speaker, so the frequency of the /// output determines the frequency of the sound produced by the speaker. For more information, /// check https://wiki.osdev.org/PC_Speaker. -#[allow(unused)] +#[expect(unused)] static CHANNEL2_PORT: IoPort = unsafe { IoPort::new(0x42) }; /// PIT command port. diff --git a/ostd/src/arch/x86/trap/gdt.rs b/ostd/src/arch/x86/trap/gdt.rs index 2bb956537..856f480dc 100644 --- a/ostd/src/arch/x86/trap/gdt.rs +++ b/ostd/src/arch/x86/trap/gdt.rs @@ -113,7 +113,7 @@ static mut USER_CS: u16 = 0; const KCODE64: u64 = 0x00209800_00000000; // EXECUTABLE | USER_SEGMENT | PRESENT | LONG_MODE const UCODE64: u64 = 0x0020F800_00000000; // EXECUTABLE | USER_SEGMENT | USER_MODE | PRESENT | LONG_MODE const KDATA64: u64 = 0x00009200_00000000; // DATA_WRITABLE | USER_SEGMENT | PRESENT -#[allow(dead_code)] +#[expect(dead_code)] const UDATA64: u64 = 0x0000F200_00000000; // DATA_WRITABLE | USER_SEGMENT | USER_MODE | PRESENT const UCODE32: u64 = 0x00cffa00_0000ffff; // EXECUTABLE | USER_SEGMENT | USER_MODE | PRESENT const UDATA32: u64 = 0x00cff200_0000ffff; // EXECUTABLE | USER_SEGMENT | USER_MODE | PRESENT diff --git a/ostd/src/arch/x86/trap/mod.rs b/ostd/src/arch/x86/trap/mod.rs index 4a1b1464c..fe570d3cf 100644 --- a/ostd/src/arch/x86/trap/mod.rs +++ b/ostd/src/arch/x86/trap/mod.rs @@ -68,7 +68,7 @@ cpu_local_cell! { /// ``` #[derive(Debug, Default, Clone, Copy)] #[repr(C)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub struct TrapFrame { // Pushed by 'trap.S' pub rax: usize, @@ -127,7 +127,7 @@ pub unsafe fn init(on_bsp: bool) { /// User space context. #[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] #[repr(C)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub struct UserContext { pub general: GeneralRegs, pub trap_num: usize, @@ -137,7 +137,7 @@ pub struct UserContext { /// General registers. #[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] #[repr(C)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub struct GeneralRegs { pub rax: usize, pub rbx: usize, diff --git a/ostd/src/boot/smp.rs b/ostd/src/boot/smp.rs index f02bcf517..ab22093b8 100644 --- a/ostd/src/boot/smp.rs +++ b/ostd/src/boot/smp.rs @@ -31,7 +31,7 @@ struct PerApInfo { // no longer be used, and the `Segment` can be deallocated (this problem also // exists in the boot processor, but the memory it occupies should be returned // to the frame allocator). - #[allow(dead_code)] + #[expect(dead_code)] boot_stack_pages: Segment, } diff --git a/ostd/src/bus/mmio/bus.rs b/ostd/src/bus/mmio/bus.rs index d22d38608..e03a20725 100644 --- a/ostd/src/bus/mmio/bus.rs +++ b/ostd/src/bus/mmio/bus.rs @@ -2,7 +2,7 @@ //! MMIO bus. -#![allow(unused_variables)] +#![expect(unused_variables)] use alloc::{collections::VecDeque, fmt::Debug, sync::Arc, vec::Vec}; diff --git a/ostd/src/bus/mmio/mod.rs b/ostd/src/bus/mmio/mod.rs index 3aa385bc2..9f2ace391 100644 --- a/ostd/src/bus/mmio/mod.rs +++ b/ostd/src/bus/mmio/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! Virtio over MMIO diff --git a/ostd/src/bus/pci/bus.rs b/ostd/src/bus/pci/bus.rs index d0a28a786..ffdbf6aa3 100644 --- a/ostd/src/bus/pci/bus.rs +++ b/ostd/src/bus/pci/bus.rs @@ -2,7 +2,7 @@ //! PCI bus -#![allow(unused_variables)] +#![expect(unused_variables)] use alloc::{collections::VecDeque, sync::Arc, vec::Vec}; use core::fmt::Debug; @@ -28,7 +28,7 @@ pub trait PciDriver: Sync + Send + Debug { /// /// Once a device is matched and claimed by a driver, /// it won't be fed to another driver for probing. - #[allow(clippy::result_large_err)] + #[expect(clippy::result_large_err)] fn probe( &self, device: PciCommonDevice, diff --git a/ostd/src/bus/pci/capability/mod.rs b/ostd/src/bus/pci/capability/mod.rs index 875ea9e3c..a6f929a42 100644 --- a/ostd/src/bus/pci/capability/mod.rs +++ b/ostd/src/bus/pci/capability/mod.rs @@ -2,7 +2,7 @@ //! PCI device capabilities. -#![allow(dead_code)] +#![expect(dead_code)] use alloc::vec::Vec; diff --git a/ostd/src/bus/pci/capability/msix.rs b/ostd/src/bus/pci/capability/msix.rs index 235df1be2..8dcd5e299 100644 --- a/ostd/src/bus/pci/capability/msix.rs +++ b/ostd/src/bus/pci/capability/msix.rs @@ -2,8 +2,8 @@ //! MSI-X capability support. -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::{sync::Arc, vec::Vec}; diff --git a/ostd/src/bus/pci/capability/vendor.rs b/ostd/src/bus/pci/capability/vendor.rs index b2bb4cc12..14bd3c113 100644 --- a/ostd/src/bus/pci/capability/vendor.rs +++ b/ostd/src/bus/pci/capability/vendor.rs @@ -26,7 +26,7 @@ impl CapabilityVndrData { } /// The length of this capability - #[allow(clippy::len_without_is_empty)] + #[expect(clippy::len_without_is_empty)] pub fn len(&self) -> u16 { self.length } diff --git a/ostd/src/bus/pci/common_device.rs b/ostd/src/bus/pci/common_device.rs index cd079b3df..8f7ce740e 100644 --- a/ostd/src/bus/pci/common_device.rs +++ b/ostd/src/bus/pci/common_device.rs @@ -2,8 +2,8 @@ //! PCI device common definitions or functions. -#![allow(dead_code)] -#![allow(unused_variables)] +#![expect(dead_code)] +#![expect(unused_variables)] use alloc::vec::Vec; diff --git a/ostd/src/cpu/local/cpu_local.rs b/ostd/src/cpu/local/cpu_local.rs index 98f9b0a84..035181ee0 100644 --- a/ostd/src/cpu/local/cpu_local.rs +++ b/ostd/src/cpu/local/cpu_local.rs @@ -192,7 +192,7 @@ impl !Send for CpuLocal {} #[must_use] pub struct CpuLocalDerefGuard<'a, T: 'static> { cpu_local: &'static CpuLocal, - #[allow(dead_code)] + #[expect(dead_code)] guard: &'a DisabledLocalIrqGuard, } diff --git a/ostd/src/lib.rs b/ostd/src/lib.rs index 15cadf8cc..21456c933 100644 --- a/ostd/src/lib.rs +++ b/ostd/src/lib.rs @@ -21,8 +21,8 @@ #![feature(trait_upcasting)] // The `generic_const_exprs` feature is incomplete however required for the page table // const generic implementation. We are using this feature in a conservative manner. -#![allow(incomplete_features)] -#![allow(internal_features)] +#![expect(incomplete_features)] +#![expect(internal_features)] #![no_std] #![warn(missing_docs)] @@ -133,7 +133,7 @@ mod test { use crate::prelude::*; #[ktest] - #[allow(clippy::eq_op)] + #[expect(clippy::eq_op)] fn trivial_assertion() { assert_eq!(0, 0); } diff --git a/ostd/src/mm/dma/dma_stream.rs b/ostd/src/mm/dma/dma_stream.rs index d54861f81..2f175c372 100644 --- a/ostd/src/mm/dma/dma_stream.rs +++ b/ostd/src/mm/dma/dma_stream.rs @@ -37,7 +37,7 @@ struct DmaStreamInner { segment: USegment, start_daddr: Daddr, /// TODO: remove this field when on x86. - #[allow(unused)] + #[expect(unused)] is_cache_coherent: bool, direction: DmaDirection, } diff --git a/ostd/src/mm/heap_allocator/mod.rs b/ostd/src/mm/heap_allocator/mod.rs index d8125fef6..d49632213 100644 --- a/ostd/src/mm/heap_allocator/mod.rs +++ b/ostd/src/mm/heap_allocator/mod.rs @@ -40,7 +40,7 @@ pub unsafe fn init() { static mut HEAP_SPACE: InitHeapSpace = InitHeapSpace([0; INIT_KERNEL_HEAP_SIZE]); // SAFETY: The HEAP_SPACE is a static memory range, so it's always valid. unsafe { - #[allow(static_mut_refs)] + #[expect(static_mut_refs)] HEAP_ALLOCATOR.init(HEAP_SPACE.0.as_mut_ptr(), INIT_KERNEL_HEAP_SIZE); } } diff --git a/ostd/src/mm/heap_allocator/slab_allocator/mod.rs b/ostd/src/mm/heap_allocator/slab_allocator/mod.rs index 326f32462..b7c505704 100644 --- a/ostd/src/mm/heap_allocator/slab_allocator/mod.rs +++ b/ostd/src/mm/heap_allocator/slab_allocator/mod.rs @@ -222,7 +222,7 @@ impl Heap { /// Returns bounds on the guaranteed usable size of a successful /// allocation created with the specified `layout`. - #[allow(unused)] + #[expect(unused)] pub fn usable_size(&self, layout: Layout) -> (usize, usize) { match Heap::layout_to_allocator(&layout) { HeapAllocator::Slab64Bytes => (layout.size(), 64), @@ -282,7 +282,7 @@ impl Heap { } /// Returns available memory size in bytes. - #[allow(unused)] + #[expect(unused)] pub fn available_bytes(&self) -> usize { self.total_bytes() - self.used_bytes() } diff --git a/ostd/src/mm/heap_allocator/slab_allocator/slab.rs b/ostd/src/mm/heap_allocator/slab_allocator/slab.rs index ea80fa5b8..4cb1adff0 100644 --- a/ostd/src/mm/heap_allocator/slab_allocator/slab.rs +++ b/ostd/src/mm/heap_allocator/slab_allocator/slab.rs @@ -120,7 +120,7 @@ impl FreeBlockList { } fn pop(&mut self) -> Option<&'static mut FreeBlock> { - #[allow(clippy::manual_inspect)] + #[expect(clippy::manual_inspect)] self.head.take().map(|node| { self.head = node.next.take(); self.len -= 1; @@ -134,7 +134,7 @@ impl FreeBlockList { self.head = Some(free_block); } - #[allow(dead_code)] + #[expect(dead_code)] fn is_empty(&self) -> bool { self.head.is_none() } diff --git a/ostd/src/mm/kspace/mod.rs b/ostd/src/mm/kspace/mod.rs index 3e8168e53..2c9843e83 100644 --- a/ostd/src/mm/kspace/mod.rs +++ b/ostd/src/mm/kspace/mod.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! Kernel memory space management. //! diff --git a/ostd/src/mm/mod.rs b/ostd/src/mm/mod.rs index 1e5b17f63..d1353d05b 100644 --- a/ostd/src/mm/mod.rs +++ b/ostd/src/mm/mod.rs @@ -86,7 +86,7 @@ pub(crate) const fn nr_subpage_per_huge() -> usize { } /// The number of base pages in a huge page at a given level. -#[allow(dead_code)] +#[expect(dead_code)] pub(crate) const fn nr_base_per_page(level: PagingLevel) -> usize { page_size::(level) / C::BASE_PAGE_SIZE } diff --git a/ostd/src/mm/page_table/cursor.rs b/ostd/src/mm/page_table/cursor.rs index c96261942..352dfb243 100644 --- a/ostd/src/mm/page_table/cursor.rs +++ b/ostd/src/mm/page_table/cursor.rs @@ -132,7 +132,7 @@ where va: Vaddr, /// The virtual address range that is locked. barrier_va: Range, - #[allow(dead_code)] + #[expect(dead_code)] preempt_guard: DisabledPreemptGuard, _phantom: PhantomData<&'a PageTable>, } diff --git a/ostd/src/mm/vm_space.rs b/ostd/src/mm/vm_space.rs index 8dadd41e0..0d800eb09 100644 --- a/ostd/src/mm/vm_space.rs +++ b/ostd/src/mm/vm_space.rs @@ -44,7 +44,7 @@ use crate::{ /// /// A `VmSpace` can also attach a page fault handler, which will be invoked to /// handle page faults generated from user space. -#[allow(clippy::type_complexity)] +#[expect(clippy::type_complexity)] #[derive(Debug)] pub struct VmSpace { pt: PageTable, @@ -282,7 +282,7 @@ impl Cursor<'_> { /// reading or modifying the same sub-tree. pub struct CursorMut<'a, 'b> { pt_cursor: page_table::CursorMut<'a, UserMode, PageTableEntry, PagingConsts>, - #[allow(dead_code)] + #[expect(dead_code)] activation_lock: RwLockReadGuard<'b, (), PreemptDisabled>, // We have a read lock so the CPU set in the flusher is always a superset // of actual activated CPUs. diff --git a/ostd/src/sync/rwlock.rs b/ostd/src/sync/rwlock.rs index a1ffe675a..699a0376a 100644 --- a/ostd/src/sync/rwlock.rs +++ b/ostd/src/sync/rwlock.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::sync::Arc; use core::{ diff --git a/ostd/src/sync/spin.rs b/ostd/src/sync/spin.rs index e4073fe1d..7743535d1 100644 --- a/ostd/src/sync/spin.rs +++ b/ostd/src/sync/spin.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] use alloc::sync::Arc; use core::{ diff --git a/ostd/src/task/kernel_stack.rs b/ostd/src/task/kernel_stack.rs index c89497d22..4e6bc8dcb 100644 --- a/ostd/src/task/kernel_stack.rs +++ b/ostd/src/task/kernel_stack.rs @@ -27,7 +27,7 @@ pub const DEFAULT_STACK_SIZE_IN_PAGES: u32 = 128; pub static KERNEL_STACK_SIZE: usize = STACK_SIZE_IN_PAGES as usize * PAGE_SIZE; #[derive(Debug)] -#[allow(dead_code)] +#[expect(dead_code)] pub struct KernelStack { kvirt_area: KVirtArea, end_vaddr: Vaddr, diff --git a/ostd/src/task/mod.rs b/ostd/src/task/mod.rs index b4fd32e2b..c5ecb9ca7 100644 --- a/ostd/src/task/mod.rs +++ b/ostd/src/task/mod.rs @@ -36,7 +36,7 @@ use crate::{prelude::*, trap::in_interrupt_context, user::UserSpace}; /// execute user code. Multiple tasks can share a single user space. #[derive(Debug)] pub struct Task { - #[allow(clippy::type_complexity)] + #[expect(clippy::type_complexity)] func: ForceSync>>>, data: Box, @@ -45,7 +45,7 @@ pub struct Task { user_space: Option>, ctx: SyncUnsafeCell, /// kernel stack, note that the top is SyscallFrame/TrapFrame - #[allow(dead_code)] + #[expect(dead_code)] kstack: KernelStack, schedule_info: TaskScheduleInfo, @@ -359,7 +359,7 @@ mod test { #[ktest] fn create_task() { - #[allow(clippy::eq_op)] + #[expect(clippy::eq_op)] let task = || { assert_eq!(1, 1); }; @@ -374,7 +374,7 @@ mod test { #[ktest] fn spawn_task() { - #[allow(clippy::eq_op)] + #[expect(clippy::eq_op)] let task = || { assert_eq!(1, 1); }; diff --git a/ostd/src/task/preempt/cpu_local.rs b/ostd/src/task/preempt/cpu_local.rs index 18970531f..e9928d660 100644 --- a/ostd/src/task/preempt/cpu_local.rs +++ b/ostd/src/task/preempt/cpu_local.rs @@ -27,7 +27,7 @@ pub(in crate::task) fn should_preempt() -> bool { PREEMPT_INFO.load() == 0 } -#[allow(dead_code)] +#[expect(dead_code)] pub(in crate::task) fn need_preempt() -> bool { PREEMPT_INFO.load() & NEED_PREEMPT_MASK == 0 } diff --git a/ostd/src/trap/irq.rs b/ostd/src/trap/irq.rs index 5d7b9a4b8..c874a9f9a 100644 --- a/ostd/src/trap/irq.rs +++ b/ostd/src/trap/irq.rs @@ -24,7 +24,7 @@ pub type IrqCallbackFunction = dyn Fn(&TrapFrame) + Sync + Send + 'static; #[must_use] pub struct IrqLine { irq_num: u8, - #[allow(clippy::redundant_allocation)] + #[expect(clippy::redundant_allocation)] inner_irq: Arc<&'static irq::IrqLine>, callbacks: Vec, } diff --git a/ostd/src/user.rs b/ostd/src/user.rs index 070b3cfaa..ceef54e78 100644 --- a/ostd/src/user.rs +++ b/ostd/src/user.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 -#![allow(dead_code)] +#![expect(dead_code)] //! User space.