From 741cc1639d7dc5b81c5c3ce9b63c8b00c45c2371 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 11 Sep 2024 22:00:55 +0200 Subject: [PATCH] ci: switch most module-level `#![allow()]` annotations to `#![expect()]` --- oro-acpi/src/madt.rs | 2 +- oro-acpica-sys/src/lib.rs | 2 +- oro-arch-aarch64/build.rs | 2 +- oro-arch-aarch64/src/asm.rs | 2 +- oro-arch-aarch64/src/lib.rs | 2 +- oro-arch-aarch64/src/mair.rs | 2 +- oro-arch-aarch64/src/mem/paging.rs | 6 +----- oro-arch-aarch64/src/reg/mair.rs | 2 +- oro-arch-x86_64/build.rs | 2 +- oro-arch-x86_64/src/asm.rs | 2 +- oro-arch-x86_64/src/lib.rs | 2 +- oro-arch-x86_64/src/mem/paging.rs | 2 +- oro-arch-x86_64/src/mem/paging_level.rs | 2 +- oro-boot-protocol/build.rs | 2 +- oro-boot-protocol/src/lib.rs | 2 +- oro-bootloader-limine/build.rs | 2 +- oro-debug-pl011/src/driver.rs | 2 +- oro-debug-pl011/src/lib.rs | 2 +- oro-kernel/src/id.rs | 2 +- oro-kernel/src/lib.rs | 1 - oro-kernel/src/module.rs | 3 +-- oro-kernel/src/port.rs | 2 -- oro-macro-proc/src/lib.rs | 4 ++-- oro-macro-proc/src/paste.rs | 2 +- oro-mem/src/lib.rs | 2 +- oro-mem/src/mapper.rs | 2 -- oro-mem/src/region.rs | 2 +- oro-mem/src/translate.rs | 2 +- oro-sync/src/barrier.rs | 2 +- oro-sync/src/spinlock/unfair.rs | 2 +- oro-sync/src/spinlock/unfair_critical.rs | 2 +- oro-type/src/lib.rs | 2 +- rust-toolchain.toml | 2 +- 33 files changed, 31 insertions(+), 41 deletions(-) diff --git a/oro-acpi/src/madt.rs b/oro-acpi/src/madt.rs index a8d097d4..ed0b5da1 100644 --- a/oro-acpi/src/madt.rs +++ b/oro-acpi/src/madt.rs @@ -1,5 +1,5 @@ //! Extension methods for the MADT table. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] use crate::sys; use core::mem::ManuallyDrop; diff --git a/oro-acpica-sys/src/lib.rs b/oro-acpica-sys/src/lib.rs index 56fae8b5..443049a7 100644 --- a/oro-acpica-sys/src/lib.rs +++ b/oro-acpica-sys/src/lib.rs @@ -3,7 +3,7 @@ //! > **NOTE:** This crate does not export any C functionality; //! > it is purely for data structures and constants. #![cfg_attr(not(test), no_std)] -#![allow( +#![expect( non_upper_case_globals, non_camel_case_types, non_snake_case, diff --git a/oro-arch-aarch64/build.rs b/oro-arch-aarch64/build.rs index 93f07707..ee6bfe08 100644 --- a/oro-arch-aarch64/build.rs +++ b/oro-arch-aarch64/build.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs, clippy::missing_docs_in_private_items)] +#![expect(missing_docs, clippy::missing_docs_in_private_items)] fn main() { println!("cargo:rustc-link-arg-bin=oro-kernel-aarch64=-T"); diff --git a/oro-arch-aarch64/src/asm.rs b/oro-arch-aarch64/src/asm.rs index 922fb4c8..80e4d725 100644 --- a/oro-arch-aarch64/src/asm.rs +++ b/oro-arch-aarch64/src/asm.rs @@ -1,5 +1,5 @@ //! One-off assembly instructions or operations for AArch64. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] use core::arch::asm; diff --git a/oro-arch-aarch64/src/lib.rs b/oro-arch-aarch64/src/lib.rs index aea7415d..6e2ca988 100644 --- a/oro-arch-aarch64/src/lib.rs +++ b/oro-arch-aarch64/src/lib.rs @@ -23,7 +23,7 @@ //! allocation or mapping. #![no_std] #![cfg(not(all(doc, not(target_arch = "aarch64"))))] -#![allow(internal_features)] +#![expect(internal_features)] #![feature(core_intrinsics)] // SAFETY(qix-): It's probably accepted, and I want to refactor the // SAFETY(qix-): page table implementaiton anyway at some point so diff --git a/oro-arch-aarch64/src/mair.rs b/oro-arch-aarch64/src/mair.rs index 45c14e0c..fa694f1c 100644 --- a/oro-arch-aarch64/src/mair.rs +++ b/oro-arch-aarch64/src/mair.rs @@ -1,5 +1,5 @@ //! Defines the Oro-specific MAIR entries for the Aarch64 architecture. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] use crate::reg::mair::{MairCacheability, MairDeviceAttribute, MairRegister}; use oro_macro::EnumIterator; diff --git a/oro-arch-aarch64/src/mem/paging.rs b/oro-arch-aarch64/src/mem/paging.rs index ba68c584..e4f826fd 100644 --- a/oro-arch-aarch64/src/mem/paging.rs +++ b/oro-arch-aarch64/src/mem/paging.rs @@ -48,11 +48,7 @@ // NOTE(qix-): In the event const traits ever get fixed and stabilized, feel free to submit a PR // NOTE(qix-): to refactor this to use const traits instead. Check the commit log for around // NOTE(qix-): 18-20 June 2024 to see what this looked like before, for inspiration. -#![allow( - clippy::inline_always, - private_bounds, - clippy::missing_docs_in_private_items -)] +#![expect(clippy::inline_always, clippy::missing_docs_in_private_items)] // TODO(qix-): Very much not happy with how this is structured. It's way too rigid and will be // TODO(qix-): nearly impossible to maintain or extend in the future. It needs a full rewrite. diff --git a/oro-arch-aarch64/src/reg/mair.rs b/oro-arch-aarch64/src/reg/mair.rs index 953533fa..6d9b866e 100644 --- a/oro-arch-aarch64/src/reg/mair.rs +++ b/oro-arch-aarch64/src/reg/mair.rs @@ -8,7 +8,7 @@ //! register. Other exception level MAIR registers are not explicitly //! supported. -#![allow(clippy::inline_always, clippy::module_name_repetitions)] +#![expect(clippy::inline_always, clippy::module_name_repetitions)] use core::{ fmt, diff --git a/oro-arch-x86_64/build.rs b/oro-arch-x86_64/build.rs index e850f8db..d39266ca 100644 --- a/oro-arch-x86_64/build.rs +++ b/oro-arch-x86_64/build.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs, clippy::missing_docs_in_private_items)] +#![expect(missing_docs, clippy::missing_docs_in_private_items)] fn main() { println!("cargo:rustc-link-arg-bin=oro-kernel-x86_64=-T"); diff --git a/oro-arch-x86_64/src/asm.rs b/oro-arch-x86_64/src/asm.rs index acaf6f98..474503fd 100644 --- a/oro-arch-x86_64/src/asm.rs +++ b/oro-arch-x86_64/src/asm.rs @@ -1,5 +1,5 @@ //! Assembly instruction stubs for the x86_64 architecture. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] use core::arch::asm; diff --git a/oro-arch-x86_64/src/lib.rs b/oro-arch-x86_64/src/lib.rs index 98b34ad3..56a6b25b 100644 --- a/oro-arch-x86_64/src/lib.rs +++ b/oro-arch-x86_64/src/lib.rs @@ -54,7 +54,7 @@ //! environment can be placed there for automatic cleanup by the kernel //! once it has booted. #![no_std] -#![allow(internal_features)] +#![expect(internal_features)] #![cfg(not(all(doc, not(target_arch = "x86_64"))))] #![feature(naked_functions, core_intrinsics)] // SAFETY(qix-): This is accepted, but moving slowly (in fact, probably the slowest diff --git a/oro-arch-x86_64/src/mem/paging.rs b/oro-arch-x86_64/src/mem/paging.rs index b89bafba..ed72399d 100644 --- a/oro-arch-x86_64/src/mem/paging.rs +++ b/oro-arch-x86_64/src/mem/paging.rs @@ -1,7 +1,7 @@ //! Memory paging (page tables, etc.) structures and implementations //! for the x86_64 architecture. -#![allow(clippy::unusual_byte_groupings)] +#![expect(clippy::unusual_byte_groupings)] use core::{ fmt, diff --git a/oro-arch-x86_64/src/mem/paging_level.rs b/oro-arch-x86_64/src/mem/paging_level.rs index df325f88..cc02f8c2 100644 --- a/oro-arch-x86_64/src/mem/paging_level.rs +++ b/oro-arch-x86_64/src/mem/paging_level.rs @@ -1,7 +1,7 @@ //! The Oro kernel supports x86_64's 4-level and 5-level paging modes, //! which are determined by the CPU flags and conveyed to certain algorithms //! with the [`PagingLevel`] enum. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] /// The number of levels in the page table hierarchy, /// as determined by the CPU flags. diff --git a/oro-boot-protocol/build.rs b/oro-boot-protocol/build.rs index 448eebad..405b273f 100644 --- a/oro-boot-protocol/build.rs +++ b/oro-boot-protocol/build.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs, clippy::missing_docs_in_private_items)] +#![expect(missing_docs, clippy::missing_docs_in_private_items)] use convert_case::{Case, Casing}; use std::{io::Write, path::PathBuf, process::Command}; diff --git a/oro-boot-protocol/src/lib.rs b/oro-boot-protocol/src/lib.rs index 62761a7c..9d3e5413 100644 --- a/oro-boot-protocol/src/lib.rs +++ b/oro-boot-protocol/src/lib.rs @@ -89,7 +89,7 @@ //! //! The resulting header file is emitted to `$CARGO_TARGET_DIR/oro-boot.h`. #![cfg_attr(not(test), no_std)] -#![allow(clippy::too_many_lines)] // Seems to be a bug in clippy with the macro expansion +#![expect(clippy::too_many_lines)] // Seems to be a bug in clippy with the macro expansion // NOTE(qix-): This module is quite hairy with macros, both procedural and otherwise. // NOTE(qix-): If you're trying to make sense of the types in here, it's probably diff --git a/oro-bootloader-limine/build.rs b/oro-bootloader-limine/build.rs index f07c6c06..ccc5f69f 100644 --- a/oro-bootloader-limine/build.rs +++ b/oro-bootloader-limine/build.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs, clippy::missing_docs_in_private_items)] +#![expect(missing_docs, clippy::missing_docs_in_private_items)] fn main() { let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap(); diff --git a/oro-debug-pl011/src/driver.rs b/oro-debug-pl011/src/driver.rs index 2bc0b99f..3a8fccbb 100644 --- a/oro-debug-pl011/src/driver.rs +++ b/oro-debug-pl011/src/driver.rs @@ -1,4 +1,4 @@ -#![allow(dead_code, clippy::missing_docs_in_private_items)] +#![expect(dead_code, clippy::missing_docs_in_private_items)] use volatile_register::{RO, RW, WO}; diff --git a/oro-debug-pl011/src/lib.rs b/oro-debug-pl011/src/lib.rs index 25d4e729..4bc266e3 100644 --- a/oro-debug-pl011/src/lib.rs +++ b/oro-debug-pl011/src/lib.rs @@ -3,7 +3,7 @@ //! Note that this is a very primitive implementation, suitable for only what //! the Oro kernel needs. #![no_std] -#![allow(internal_features)] +#![expect(internal_features)] #![feature(core_intrinsics)] mod driver; diff --git a/oro-kernel/src/id.rs b/oro-kernel/src/id.rs index 7551b0b7..773101e8 100644 --- a/oro-kernel/src/id.rs +++ b/oro-kernel/src/id.rs @@ -1,5 +1,5 @@ //! Implements Oro IDs in the kernel. -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use core::{marker::ConstParamTy, str::FromStr}; diff --git a/oro-kernel/src/lib.rs b/oro-kernel/src/lib.rs index 193e0581..6e0e70a3 100644 --- a/oro-kernel/src/lib.rs +++ b/oro-kernel/src/lib.rs @@ -7,7 +7,6 @@ // NOTE(qix-): `adt_const_params` isn't strictly necessary but is on track for acceptance, // NOTE(qix-): and the open questions (e.g. mangling) are not of concern here. // NOTE(qix-): https://github.com/rust-lang/rust/issues/95174 -#![allow(incomplete_features)] #![feature(adt_const_params)] use oro_mem::{ diff --git a/oro-kernel/src/module.rs b/oro-kernel/src/module.rs index 78d684ac..80cf633a 100644 --- a/oro-kernel/src/module.rs +++ b/oro-kernel/src/module.rs @@ -1,6 +1,5 @@ //! Implements Oro module instances in the kernel. -#![allow(clippy::module_name_repetitions)] -#![allow(dead_code)] // TODO(qix-) +#![expect(clippy::module_name_repetitions)] use crate::id::{Id, IdType}; diff --git a/oro-kernel/src/port.rs b/oro-kernel/src/port.rs index 2e3dbc69..d4eb5996 100644 --- a/oro-kernel/src/port.rs +++ b/oro-kernel/src/port.rs @@ -1,7 +1,5 @@ //! Implements Oro ports in the kernel. -#![allow(dead_code)] // TODO(qix-) - use crate::id::{Id, IdType}; /// A singular port. diff --git a/oro-macro-proc/src/lib.rs b/oro-macro-proc/src/lib.rs index 49bb317e..9c0f1604 100644 --- a/oro-macro-proc/src/lib.rs +++ b/oro-macro-proc/src/lib.rs @@ -2,9 +2,9 @@ //! //! > **NOTE:** Don't use this crate directly; instead, use the `oro-macro` crate. #![deny(missing_docs, clippy::missing_docs_in_private_items)] -#![allow(clippy::module_name_repetitions, clippy::missing_errors_doc)] +#![expect(clippy::module_name_repetitions)] // TODO(qix-): Remove this when is fixed -#![allow(clippy::tabs_in_doc_comments)] +#![expect(clippy::tabs_in_doc_comments)] #![feature(let_chains, proc_macro_span)] mod asm_buffer; diff --git a/oro-macro-proc/src/paste.rs b/oro-macro-proc/src/paste.rs index f3fb6766..c4acced0 100644 --- a/oro-macro-proc/src/paste.rs +++ b/oro-macro-proc/src/paste.rs @@ -1,5 +1,5 @@ //! Core functionality for the `paste!()` macro. -#![allow(clippy::missing_docs_in_private_items)] +#![expect(clippy::missing_docs_in_private_items)] use convert_case::{Case, Casing}; use proc_macro2::{Span, TokenTree}; diff --git a/oro-mem/src/lib.rs b/oro-mem/src/lib.rs index cfbada1f..2f4fba4b 100644 --- a/oro-mem/src/lib.rs +++ b/oro-mem/src/lib.rs @@ -1,6 +1,6 @@ //! Common memory types and functions for the Oro kernel. #![cfg_attr(not(test), no_std)] -#![allow(internal_features)] +#![expect(internal_features)] #![feature(core_intrinsics, never_type)] #![cfg_attr(debug_assertions, feature(naked_functions))] diff --git a/oro-mem/src/mapper.rs b/oro-mem/src/mapper.rs index 183f340b..243e3d24 100644 --- a/oro-mem/src/mapper.rs +++ b/oro-mem/src/mapper.rs @@ -6,8 +6,6 @@ //! The kernel will allocate memory into specific regions, leaving the //! architecture to properly set up all flags and other necessary controls //! for those regions to behave as the kernel expects. -#![allow(clippy::inline_always)] - use crate::{ pfa::alloc::{PageFrameAllocate, PageFrameFree}, translate::Translator, diff --git a/oro-mem/src/region.rs b/oro-mem/src/region.rs index d7d94138..3f2b2eda 100644 --- a/oro-mem/src/region.rs +++ b/oro-mem/src/region.rs @@ -13,7 +13,7 @@ //! memory maps and regions into the "current" execution context, making them //! usable by the CPU. -#![allow(clippy::module_name_repetitions, clippy::inline_always)] +#![expect(clippy::module_name_repetitions)] /// An extension trait for [`MemoryRegion`] and its proxy. pub trait MemoryRegion: Sized { diff --git a/oro-mem/src/translate.rs b/oro-mem/src/translate.rs index 9ce1052a..49b618f8 100644 --- a/oro-mem/src/translate.rs +++ b/oro-mem/src/translate.rs @@ -1,5 +1,5 @@ //! Memory address translation utilities for the pre-boot stage. -#![allow(clippy::inline_always)] +#![expect(clippy::inline_always)] /// Translates a page frame to a virtual address, used in the pre-boot stage /// to write kernel configuration structures. diff --git a/oro-sync/src/barrier.rs b/oro-sync/src/barrier.rs index 1f654a99..45d4eb1d 100644 --- a/oro-sync/src/barrier.rs +++ b/oro-sync/src/barrier.rs @@ -1,6 +1,6 @@ //! Barrier types, used to synchronize multiple cores in lockstep. -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use core::sync::atomic::{AtomicU64, Ordering}; diff --git a/oro-sync/src/spinlock/unfair.rs b/oro-sync/src/spinlock/unfair.rs index 84a5230f..739ded9b 100644 --- a/oro-sync/src/spinlock/unfair.rs +++ b/oro-sync/src/spinlock/unfair.rs @@ -1,7 +1,7 @@ //! Provides the [`UnfairSpinlock`] type, a simple spinlock that does not //! guarantee fairness and may result in starvation. -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use core::{ cell::UnsafeCell, diff --git a/oro-sync/src/spinlock/unfair_critical.rs b/oro-sync/src/spinlock/unfair_critical.rs index 8032b345..1af684d2 100644 --- a/oro-sync/src/spinlock/unfair_critical.rs +++ b/oro-sync/src/spinlock/unfair_critical.rs @@ -2,7 +2,7 @@ //! guarantee fairness and may result in starvation, that also disables //! interrupts for the lifetime of an acquired lock. -#![allow(clippy::module_name_repetitions)] +#![expect(clippy::module_name_repetitions)] use core::{ cell::UnsafeCell, diff --git a/oro-type/src/lib.rs b/oro-type/src/lib.rs index dff4557e..9f094004 100644 --- a/oro-type/src/lib.rs +++ b/oro-type/src/lib.rs @@ -4,7 +4,7 @@ //! wrappers and associated traits for them (e.g. //! forced endianness types). #![cfg_attr(not(test), no_std)] -#![allow(clippy::inline_always, clippy::wrong_self_convention)] +#![expect(clippy::inline_always, clippy::wrong_self_convention)] use core::marker::PhantomData; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c45a5a7a..bd564d03 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2024-09-08" +channel = "nightly-2024-09-11" components = [ "rustfmt", "rustc-dev", "clippy", "rust-src", "llvm-tools-preview" ] targets = [ "x86_64-unknown-none", "aarch64-unknown-none" ] profile = "minimal"