diff --git a/aya-build/src/lib.rs b/aya-build/src/lib.rs index c8e9996a..4bf8ffcc 100644 --- a/aya-build/src/lib.rs +++ b/aya-build/src/lib.rs @@ -104,7 +104,7 @@ pub fn build_ebpf(packages: impl IntoIterator) -> Result<()> { let stdout = BufReader::new(stdout); let mut executables = Vec::new(); for message in Message::parse_stream(stdout) { - #[allow(clippy::collapsible_match)] + #[expect(clippy::collapsible_match)] match message.expect("valid JSON") { Message::CompilerArtifact(Artifact { executable, diff --git a/aya-ebpf-macros/src/kprobe.rs b/aya-ebpf-macros/src/kprobe.rs index d24b60d7..7af980ed 100644 --- a/aya-ebpf-macros/src/kprobe.rs +++ b/aya-ebpf-macros/src/kprobe.rs @@ -7,7 +7,6 @@ use syn::{spanned::Spanned as _, ItemFn}; use crate::args::{err_on_unknown_args, pop_string_arg}; -#[allow(clippy::enum_variant_names)] #[derive(Debug, Copy, Clone)] pub(crate) enum KProbeKind { KProbe, diff --git a/aya-ebpf-macros/src/lib.rs b/aya-ebpf-macros/src/lib.rs index acb6fbd9..13604218 100644 --- a/aya-ebpf-macros/src/lib.rs +++ b/aya-ebpf-macros/src/lib.rs @@ -471,7 +471,7 @@ pub fn socket_filter(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![allow(non_camel_case_types)] +/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fentry, programs::FEntryContext}; /// # type filename = u32; /// # type path = u32; @@ -513,7 +513,7 @@ pub fn fentry(attrs: TokenStream, item: TokenStream) -> TokenStream { /// # Examples /// /// ```no_run -/// # #![allow(non_camel_case_types)] +/// # #![expect(non_camel_case_types)] /// use aya_ebpf::{macros::fexit, programs::FExitContext}; /// # type filename = u32; /// # type path = u32; diff --git a/aya-ebpf-macros/src/sk_skb.rs b/aya-ebpf-macros/src/sk_skb.rs index 6dbb43df..d1898eec 100644 --- a/aya-ebpf-macros/src/sk_skb.rs +++ b/aya-ebpf-macros/src/sk_skb.rs @@ -5,7 +5,6 @@ use proc_macro2_diagnostics::{Diagnostic, SpanDiagnosticExt as _}; use quote::quote; use syn::{spanned::Spanned as _, ItemFn}; -#[allow(clippy::enum_variant_names)] #[derive(Debug, Copy, Clone)] pub(crate) enum SkSkbKind { StreamVerdict, diff --git a/aya-ebpf-macros/src/uprobe.rs b/aya-ebpf-macros/src/uprobe.rs index 2d43766c..a3f5a8ac 100644 --- a/aya-ebpf-macros/src/uprobe.rs +++ b/aya-ebpf-macros/src/uprobe.rs @@ -7,7 +7,6 @@ use syn::{spanned::Spanned as _, ItemFn}; use crate::args::{err_on_unknown_args, pop_bool_arg, pop_string_arg}; -#[allow(clippy::enum_variant_names)] #[derive(Debug, Copy, Clone)] pub(crate) enum UProbeKind { UProbe, diff --git a/aya-log-common/src/lib.rs b/aya-log-common/src/lib.rs index 7d538fd4..d6a06316 100644 --- a/aya-log-common/src/lib.rs +++ b/aya-log-common/src/lib.rs @@ -167,7 +167,7 @@ pub enum DisplayHint { pub(crate) fn write(tag: u8, value: &[u8], buf: &mut [u8]) -> Option { // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this allowance when the // lint behaves more sensibly. - #[allow(clippy::manual_ok_err)] + #[expect(clippy::manual_ok_err)] let wire_len: LogValueLength = match value.len().try_into() { Ok(wire_len) => Some(wire_len), Err(TryFromIntError { .. }) => None, diff --git a/aya-log/src/lib.rs b/aya-log/src/lib.rs index 4e6dc567..a2e03c48 100644 --- a/aya-log/src/lib.rs +++ b/aya-log/src/lib.rs @@ -75,11 +75,11 @@ use bytes::BytesMut; use log::{error, Log, Record}; use thiserror::Error; -#[allow(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remove when false positive is fixed. +#[expect(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remove when false positive is fixed. #[derive(Copy, Clone)] #[repr(transparent)] struct RecordFieldWrapper(RecordField); -#[allow(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remove when false positive is fixed. +#[expect(dead_code)] // TODO(https://github.com/rust-lang/rust/issues/120770): Remove when false positive is fixed. #[derive(Copy, Clone)] #[repr(transparent)] struct ArgumentWrapper(Argument); diff --git a/aya-obj/src/btf/btf.rs b/aya-obj/src/btf/btf.rs index 6b34e763..81533a0b 100644 --- a/aya-obj/src/btf/btf.rs +++ b/aya-obj/src/btf/btf.rs @@ -159,7 +159,6 @@ pub enum BtfError { /// Available BTF features #[derive(Default, Debug)] -#[allow(missing_docs)] pub struct BtfFeatures { btf_func: bool, btf_func_global: bool, diff --git a/aya-obj/src/btf/mod.rs b/aya-obj/src/btf/mod.rs index a5606e5e..a5faf817 100644 --- a/aya-obj/src/btf/mod.rs +++ b/aya-obj/src/btf/mod.rs @@ -1,6 +1,6 @@ //! BTF loading, parsing and relocation. -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod btf; mod info; mod relocation; diff --git a/aya-obj/src/btf/relocation.rs b/aya-obj/src/btf/relocation.rs index 90dfeccb..91fe4c4d 100644 --- a/aya-obj/src/btf/relocation.rs +++ b/aya-obj/src/btf/relocation.rs @@ -194,7 +194,6 @@ pub(crate) struct Relocation { } impl Relocation { - #[allow(unused_unsafe)] pub(crate) unsafe fn parse(data: &[u8], number: usize) -> Result { if mem::size_of::() > data.len() { return Err(BtfError::InvalidRelocationInfo); @@ -1189,7 +1188,6 @@ impl ComputedRelocation { type_id: None, }; - #[allow(clippy::wildcard_in_or_patterns)] match rel.kind { FieldByteOffset => { value.value = byte_off as u64; diff --git a/aya-obj/src/btf/types.rs b/aya-obj/src/btf/types.rs index 39f078cc..e3642bcd 100644 --- a/aya-obj/src/btf/types.rs +++ b/aya-obj/src/btf/types.rs @@ -1,4 +1,4 @@ -#![allow(missing_docs)] +#![expect(missing_docs)] use alloc::{string::ToString, vec, vec::Vec}; use core::{fmt::Display, mem, ptr}; @@ -1133,7 +1133,6 @@ unsafe fn read_array(data: &[u8], len: usize) -> Result, BtfError> { } impl BtfType { - #[allow(unused_unsafe)] pub(crate) unsafe fn read(data: &[u8], endianness: Endianness) -> Result { let ty = unsafe { read_array::(data, 3)? }; let data = &data[mem::size_of::() * 3..]; diff --git a/aya-obj/src/generated/mod.rs b/aya-obj/src/generated/mod.rs index 809c3313..f786447f 100644 --- a/aya-obj/src/generated/mod.rs +++ b/aya-obj/src/generated/mod.rs @@ -1,13 +1,5 @@ //! eBPF bindings generated by rust-bindgen -#![allow( - dead_code, - non_camel_case_types, - non_snake_case, - clippy::all, - missing_docs -)] - mod btf_internal_bindings; #[cfg(target_arch = "aarch64")] mod linux_bindings_aarch64; diff --git a/aya-obj/src/lib.rs b/aya-obj/src/lib.rs index f1054707..5220662a 100644 --- a/aya-obj/src/lib.rs +++ b/aya-obj/src/lib.rs @@ -66,13 +66,14 @@ )] #![cfg_attr(docsrs, feature(doc_cfg))] #![deny(clippy::all, missing_docs)] -#![allow(clippy::missing_safety_doc, clippy::len_without_is_empty)] +#![expect(clippy::len_without_is_empty)] extern crate alloc; #[cfg(feature = "std")] extern crate std; pub mod btf; +#[expect(clippy::all, missing_docs, non_camel_case_types, non_snake_case)] pub mod generated; pub mod links; pub mod maps; diff --git a/aya-obj/src/maps.rs b/aya-obj/src/maps.rs index 902c5b17..42d8ce80 100644 --- a/aya-obj/src/maps.rs +++ b/aya-obj/src/maps.rs @@ -107,7 +107,6 @@ impl TryFrom for PinningType { } /// Map definition in legacy BPF map declaration style -#[allow(non_camel_case_types)] #[repr(C)] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct bpf_map_def { diff --git a/aya-obj/src/obj.rs b/aya-obj/src/obj.rs index 30801da2..f628d9ec 100644 --- a/aya-obj/src/obj.rs +++ b/aya-obj/src/obj.rs @@ -37,7 +37,6 @@ const KERNEL_VERSION_ANY: u32 = 0xFFFF_FFFE; /// Features implements BPF and BTF feature detection #[derive(Default, Debug)] -#[allow(missing_docs)] pub struct Features { bpf_name: bool, bpf_probe_read_kernel: bool, @@ -53,7 +52,7 @@ pub struct Features { impl Features { #[doc(hidden)] - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn new( bpf_name: bool, bpf_probe_read_kernel: bool, @@ -238,7 +237,7 @@ pub struct Function { /// - `fmod_ret+`, `fmod_ret.s+` /// - `iter+`, `iter.s+` #[derive(Debug, Clone)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub enum ProgramSection { KRetProbe, KProbe, @@ -939,7 +938,7 @@ impl Function { /// Errors caught during parsing the object file #[derive(Debug, thiserror::Error)] -#[allow(missing_docs)] +#[expect(missing_docs)] pub enum ParseError { #[error("error parsing ELF data")] ElfError(object::read::Error), diff --git a/aya/src/lib.rs b/aya/src/lib.rs index 808f3ac9..011f9f91 100644 --- a/aya/src/lib.rs +++ b/aya/src/lib.rs @@ -71,10 +71,10 @@ //unused_qualifications, https://github.com/rust-lang/rust/commit/9ccc7b7 added size_of to the prelude, but we need to continue to qualify it so that we build on older compilers. //unused_results, )] -#![allow(clippy::missing_safety_doc, clippy::len_without_is_empty)] +#![expect(clippy::missing_safety_doc, clippy::len_without_is_empty)] #![cfg_attr( all(feature = "async_tokio", feature = "async_std"), - allow(unused_crate_dependencies) + expect(unused_crate_dependencies) )] mod bpf; diff --git a/aya/src/maps/array/mod.rs b/aya/src/maps/array/mod.rs index 728e4851..1b2768dc 100644 --- a/aya/src/maps/array/mod.rs +++ b/aya/src/maps/array/mod.rs @@ -1,5 +1,5 @@ //! Array types. -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod array; mod per_cpu_array; mod program_array; diff --git a/aya/src/maps/hash_map/mod.rs b/aya/src/maps/hash_map/mod.rs index 054dfda0..6dffb688 100644 --- a/aya/src/maps/hash_map/mod.rs +++ b/aya/src/maps/hash_map/mod.rs @@ -7,7 +7,7 @@ use crate::{ Pod, }; -#[allow(clippy::module_inception)] +#[expect(clippy::module_inception)] mod hash_map; mod per_cpu_hash_map; diff --git a/aya/src/maps/ring_buf.rs b/aya/src/maps/ring_buf.rs index 7e31e34f..3285a3cc 100644 --- a/aya/src/maps/ring_buf.rs +++ b/aya/src/maps/ring_buf.rs @@ -121,7 +121,7 @@ impl RingBuf { // lifetime of the iterator in the returned `RingBufItem`. If the Iterator::Item leveraged GATs, // one could imagine an implementation of `Iterator` that would work. GATs are stabilized in // Rust 1.65, but there's not yet a trait that the community seems to have standardized around. - #[allow(clippy::should_implement_trait)] + #[expect(clippy::should_implement_trait)] pub fn next(&mut self) -> Option> { let Self { consumer, producer, .. diff --git a/aya/src/programs/perf_event.rs b/aya/src/programs/perf_event.rs index 9dad3591..e935c898 100644 --- a/aya/src/programs/perf_event.rs +++ b/aya/src/programs/perf_event.rs @@ -53,7 +53,6 @@ pub enum SamplePolicy { /// The scope of a PerfEvent #[derive(Debug, Clone)] -#[allow(clippy::enum_variant_names)] pub enum PerfEventScope { /// Calling process, any cpu CallingProcessAnyCpu, diff --git a/aya/src/programs/probe.rs b/aya/src/programs/probe.rs index 43db919c..8b5b9272 100644 --- a/aya/src/programs/probe.rs +++ b/aya/src/programs/probe.rs @@ -62,7 +62,7 @@ pub(crate) fn lines(bytes: &[u8]) -> impl Iterator { pub(crate) trait OsStringExt { fn starts_with(&self, needle: &OsStr) -> bool; - #[allow(dead_code)] // Would be odd to have the others without this one. + #[expect(dead_code)] // Would be odd to have the others without this one. fn ends_with(&self, needle: &OsStr) -> bool; fn strip_prefix(&self, prefix: &OsStr) -> Option<&OsStr>; fn strip_suffix(&self, suffix: &OsStr) -> Option<&OsStr>; diff --git a/aya/src/sys/mod.rs b/aya/src/sys/mod.rs index 5c7d173f..6d649187 100644 --- a/aya/src/sys/mod.rs +++ b/aya/src/sys/mod.rs @@ -147,7 +147,7 @@ fn syscall(call: Syscall<'_>) -> SysResult { } } -#[cfg_attr(test, allow(unused_variables))] +#[cfg_attr(test, expect(unused_variables))] pub(crate) unsafe fn mmap( addr: *mut c_void, len: usize, @@ -169,7 +169,7 @@ pub(crate) unsafe fn mmap( } } -#[cfg_attr(test, allow(unused_variables))] +#[cfg_attr(test, expect(unused_variables))] pub(crate) unsafe fn munmap(addr: *mut c_void, len: usize) -> c_int { #[cfg(not(test))] return libc::munmap(addr, len); diff --git a/aya/src/sys/perf_event.rs b/aya/src/sys/perf_event.rs index 58b98b46..cffec976 100644 --- a/aya/src/sys/perf_event.rs +++ b/aya/src/sys/perf_event.rs @@ -15,7 +15,7 @@ use libc::pid_t; use super::{syscall, PerfEventIoctlRequest, Syscall}; -#[allow(clippy::too_many_arguments)] +#[expect(clippy::too_many_arguments)] pub(crate) fn perf_event_open( perf_type: u32, config: u64, diff --git a/aya/src/util.rs b/aya/src/util.rs index ba9af55a..4964d705 100644 --- a/aya/src/util.rs +++ b/aya/src/util.rs @@ -298,7 +298,7 @@ fn parse_kernel_symbols(reader: impl BufRead) -> Result, i let name = parts.next()?; // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this // allowance when the lint behaves more sensibly. - #[allow(clippy::manual_ok_err)] + #[expect(clippy::manual_ok_err)] let addr = match u64::from_str_radix(addr, 16) { Ok(addr) => Some(addr), Err(ParseIntError { .. }) => None, diff --git a/ebpf/aya-ebpf-bindings/src/aarch64/mod.rs b/ebpf/aya-ebpf-bindings/src/aarch64/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/aarch64/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/aarch64/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/armv7/mod.rs b/ebpf/aya-ebpf-bindings/src/armv7/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/armv7/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/armv7/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/lib.rs b/ebpf/aya-ebpf-bindings/src/lib.rs index 90c24f46..15d37b88 100644 --- a/ebpf/aya-ebpf-bindings/src/lib.rs +++ b/ebpf/aya-ebpf-bindings/src/lib.rs @@ -1,4 +1,10 @@ -#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![expect( + clippy::all, + dead_code, + non_camel_case_types, + non_snake_case, + non_upper_case_globals +)] #![deny(warnings)] #![no_std] diff --git a/ebpf/aya-ebpf-bindings/src/mips/mod.rs b/ebpf/aya-ebpf-bindings/src/mips/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/mips/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/mips/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs b/ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/riscv64/mod.rs b/ebpf/aya-ebpf-bindings/src/riscv64/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/riscv64/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/riscv64/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/s390x/mod.rs b/ebpf/aya-ebpf-bindings/src/s390x/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/s390x/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/s390x/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-bindings/src/x86_64/mod.rs b/ebpf/aya-ebpf-bindings/src/x86_64/mod.rs index 226884ea..2d144a25 100644 --- a/ebpf/aya-ebpf-bindings/src/x86_64/mod.rs +++ b/ebpf/aya-ebpf-bindings/src/x86_64/mod.rs @@ -1,3 +1,2 @@ -#![allow(clippy::all, dead_code)] pub mod bindings; pub mod helpers; diff --git a/ebpf/aya-ebpf-cty/src/lib.rs b/ebpf/aya-ebpf-cty/src/lib.rs index 6b0dd37d..33d2bd0b 100644 --- a/ebpf/aya-ebpf-cty/src/lib.rs +++ b/ebpf/aya-ebpf-cty/src/lib.rs @@ -5,7 +5,7 @@ //! This crate is guaranteed to compile on stable Rust 1.30.0 and up. It *might* compile with older //! versions but that may change in any new patch release. #![no_std] -#![allow(non_camel_case_types)] +#![expect(non_camel_case_types)] #![deny(warnings)] // AD = Architecture dependent diff --git a/ebpf/aya-ebpf/src/helpers.rs b/ebpf/aya-ebpf/src/helpers.rs index f96044f3..c6f4e282 100644 --- a/ebpf/aya-ebpf/src/helpers.rs +++ b/ebpf/aya-ebpf/src/helpers.rs @@ -35,7 +35,7 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -72,7 +72,7 @@ pub unsafe fn bpf_probe_read(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let ptr: *const u8 = 0 as _; @@ -108,7 +108,7 @@ pub unsafe fn bpf_probe_read_buf(src: *const u8, dst: &mut [u8]) -> Result<(), c /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const c_int = 0 as _; @@ -143,7 +143,7 @@ pub unsafe fn bpf_probe_read_user(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -179,7 +179,7 @@ pub unsafe fn bpf_probe_read_user_buf(src: *const u8, dst: &mut [u8]) -> Result< /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const c_int = 0 as _; @@ -214,7 +214,7 @@ pub unsafe fn bpf_probe_read_kernel(src: *const T) -> Result { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel_buf}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -253,7 +253,7 @@ pub unsafe fn bpf_probe_read_kernel_buf(src: *const u8, dst: &mut [u8]) -> Resul /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -291,7 +291,7 @@ pub unsafe fn bpf_probe_read_str(src: *const u8, dest: &mut [u8]) -> Result Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -332,7 +332,7 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let user_ptr: *const u8 = 0 as _; @@ -375,7 +375,7 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result /// [core::str::from_utf8_unchecked]: /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # use aya_ebpf::{macros::map, maps::PerCpuArray}; /// # #[repr(C)] @@ -441,7 +441,7 @@ fn read_str_bytes(len: i64, dest: &[u8]) -> Result<&[u8], c_long> { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -482,7 +482,7 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu /// eBPF stack limit is 512 bytes): /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # fn try_test() -> Result<(), c_long> { /// # let kernel_ptr: *const u8 = 0 as _; @@ -497,7 +497,7 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu /// With a `PerCpuArray` (with size defined by us): /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// use aya_ebpf::{macros::map, maps::PerCpuArray}; /// @@ -526,7 +526,7 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu /// [core::str::from_utf8_unchecked]: /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # use aya_ebpf::{macros::map, maps::PerCpuArray}; /// # #[repr(C)] @@ -572,7 +572,7 @@ pub unsafe fn bpf_probe_read_kernel_str_bytes( /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::{ /// # cty::{c_int, c_long}, /// # helpers::bpf_probe_write_user, @@ -611,7 +611,7 @@ pub unsafe fn bpf_probe_write_user(dst: *mut T, src: *const T) -> Result<(), /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_comm; /// let comm = bpf_get_current_comm(); /// @@ -648,7 +648,7 @@ pub fn bpf_get_current_comm() -> Result<[u8; 16], c_long> { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_pid_tgid; /// let tgid = (bpf_get_current_pid_tgid() >> 32) as u32; /// let pid = bpf_get_current_pid_tgid() as u32; @@ -671,7 +671,7 @@ pub fn bpf_get_current_pid_tgid() -> u64 { /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// # use aya_ebpf::helpers::bpf_get_current_uid_gid; /// let gid = (bpf_get_current_uid_gid() >> 32) as u32; /// let uid = bpf_get_current_uid_gid() as u32; diff --git a/ebpf/aya-ebpf/src/lib.rs b/ebpf/aya-ebpf/src/lib.rs index ea820aa4..282c8467 100644 --- a/ebpf/aya-ebpf/src/lib.rs +++ b/ebpf/aya-ebpf/src/lib.rs @@ -8,10 +8,10 @@ html_logo_url = "https://aya-rs.dev/assets/images/crabby.svg", html_favicon_url = "https://aya-rs.dev/assets/images/crabby.svg" )] -#![cfg_attr(unstable, allow(incomplete_features), feature(generic_const_exprs))] +#![cfg_attr(unstable, expect(incomplete_features), feature(generic_const_exprs))] #![cfg_attr(unstable, feature(never_type))] #![cfg_attr(target_arch = "bpf", feature(asm_experimental_arch))] -#![allow(clippy::missing_safety_doc)] +#![expect(clippy::missing_safety_doc)] #![deny(warnings)] #![warn(clippy::cast_lossless, clippy::cast_sign_loss)] #![no_std] @@ -63,7 +63,7 @@ pub trait EbpfContext { #[no_mangle] pub unsafe extern "C" fn memset(s: *mut u8, c: c_int, n: usize) { - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_sign_loss)] let b = c as u8; for i in 0..n { *s.add(i) = b; diff --git a/ebpf/aya-ebpf/src/maps/program_array.rs b/ebpf/aya-ebpf/src/maps/program_array.rs index 786b98a7..334420ef 100644 --- a/ebpf/aya-ebpf/src/maps/program_array.rs +++ b/ebpf/aya-ebpf/src/maps/program_array.rs @@ -14,7 +14,7 @@ use crate::{ /// # Examples /// /// ```no_run -/// # #![allow(dead_code)] +/// # #![expect(dead_code)] /// use aya_ebpf::{macros::map, maps::ProgramArray, cty::c_long}; /// # use aya_ebpf::{programs::LsmContext}; /// diff --git a/ebpf/aya-ebpf/src/programs/fentry.rs b/ebpf/aya-ebpf/src/programs/fentry.rs index af82ca7c..49290ff4 100644 --- a/ebpf/aya-ebpf/src/programs/fentry.rs +++ b/ebpf/aya-ebpf/src/programs/fentry.rs @@ -16,8 +16,8 @@ impl FEntryContext { /// # Examples /// /// ```no_run - /// # #![allow(non_camel_case_types)] - /// # #![allow(dead_code)] + /// # #![expect(non_camel_case_types)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FEntryContext}; /// # type pid_t = c_int; /// # struct task_struct { diff --git a/ebpf/aya-ebpf/src/programs/fexit.rs b/ebpf/aya-ebpf/src/programs/fexit.rs index d9728832..d05e43dd 100644 --- a/ebpf/aya-ebpf/src/programs/fexit.rs +++ b/ebpf/aya-ebpf/src/programs/fexit.rs @@ -16,8 +16,8 @@ impl FExitContext { /// # Examples /// /// ```no_run - /// # #![allow(non_camel_case_types)] - /// # #![allow(dead_code)] + /// # #![expect(non_camel_case_types)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{cty::c_int, programs::FExitContext}; /// # type pid_t = c_int; /// # struct task_struct { diff --git a/ebpf/aya-ebpf/src/programs/lsm.rs b/ebpf/aya-ebpf/src/programs/lsm.rs index 0ad29590..87262602 100644 --- a/ebpf/aya-ebpf/src/programs/lsm.rs +++ b/ebpf/aya-ebpf/src/programs/lsm.rs @@ -29,7 +29,7 @@ impl LsmContext { /// # Examples /// /// ```no_run - /// # #![allow(dead_code)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::LsmContext, cty::{c_int, c_ulong}}; /// unsafe fn try_lsm_mmap_addr(ctx: LsmContext) -> Result { /// // In the kernel, this hook is defined as: diff --git a/ebpf/aya-ebpf/src/programs/probe.rs b/ebpf/aya-ebpf/src/programs/probe.rs index a2932e68..79e93f1d 100644 --- a/ebpf/aya-ebpf/src/programs/probe.rs +++ b/ebpf/aya-ebpf/src/programs/probe.rs @@ -31,8 +31,8 @@ impl ProbeContext { /// # Examples /// /// ```no_run - /// # #![allow(non_camel_case_types)] - /// # #![allow(dead_code)] + /// # #![expect(non_camel_case_types)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::ProbeContext, cty::c_int, helpers::bpf_probe_read}; /// # type pid_t = c_int; /// # struct task_struct { diff --git a/ebpf/aya-ebpf/src/programs/retprobe.rs b/ebpf/aya-ebpf/src/programs/retprobe.rs index 0b6f3e57..75c949e2 100644 --- a/ebpf/aya-ebpf/src/programs/retprobe.rs +++ b/ebpf/aya-ebpf/src/programs/retprobe.rs @@ -31,7 +31,7 @@ impl RetProbeContext { /// # Examples /// /// ```no_run - /// # #![allow(dead_code)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::RetProbeContext, cty::c_int}; /// unsafe fn try_kretprobe_try_to_wake_up(ctx: RetProbeContext) -> Result { /// let retval: c_int = ctx.ret().ok_or(1u32)?; diff --git a/ebpf/aya-ebpf/src/programs/sk_buff.rs b/ebpf/aya-ebpf/src/programs/sk_buff.rs index c7712f83..a1bdba4d 100644 --- a/ebpf/aya-ebpf/src/programs/sk_buff.rs +++ b/ebpf/aya-ebpf/src/programs/sk_buff.rs @@ -21,7 +21,7 @@ impl SkBuff { SkBuff { skb } } - #[allow(clippy::len_without_is_empty)] + #[expect(clippy::len_without_is_empty)] #[inline] pub fn len(&self) -> u32 { unsafe { (*self.skb).len } @@ -270,7 +270,7 @@ impl SkBuffContext { SkBuffContext { skb } } - #[allow(clippy::len_without_is_empty)] + #[expect(clippy::len_without_is_empty)] #[inline] pub fn len(&self) -> u32 { self.skb.len() @@ -316,11 +316,11 @@ impl SkBuffContext { /// use core::mem; /// /// use aya_ebpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::SkBuffContext}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct ethhdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct iphdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct tcphdr {}; /// /// const ETH_HDR_LEN: usize = mem::size_of::(); @@ -405,11 +405,11 @@ impl SkBuffContext { /// /// ```no_run /// use aya_ebpf::programs::SkBuffContext; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct ethhdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct iphdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct udphdr {}; /// /// const ETH_HLEN: usize = core::mem::size_of::(); diff --git a/ebpf/aya-ebpf/src/programs/tc.rs b/ebpf/aya-ebpf/src/programs/tc.rs index 68f651c4..61f73d66 100644 --- a/ebpf/aya-ebpf/src/programs/tc.rs +++ b/ebpf/aya-ebpf/src/programs/tc.rs @@ -12,7 +12,7 @@ impl TcContext { TcContext { skb } } - #[allow(clippy::len_without_is_empty)] + #[expect(clippy::len_without_is_empty)] #[inline] pub fn len(&self) -> u32 { self.skb.len() @@ -68,11 +68,11 @@ impl TcContext { /// use core::mem; /// /// use aya_ebpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::TcContext}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct ethhdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct iphdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct tcphdr {}; /// /// const ETH_HDR_LEN: usize = mem::size_of::(); @@ -162,11 +162,11 @@ impl TcContext { /// /// ```no_run /// use aya_ebpf::programs::TcContext; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct ethhdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct iphdr {}; - /// # #[allow(non_camel_case_types)] + /// # #[expect(non_camel_case_types)] /// # struct udphdr {}; /// /// const ETH_HLEN: usize = core::mem::size_of::(); diff --git a/ebpf/aya-ebpf/src/programs/tp_btf.rs b/ebpf/aya-ebpf/src/programs/tp_btf.rs index 0c8a7991..70bd1d83 100644 --- a/ebpf/aya-ebpf/src/programs/tp_btf.rs +++ b/ebpf/aya-ebpf/src/programs/tp_btf.rs @@ -23,7 +23,7 @@ impl BtfTracePointContext { /// # Examples /// /// ```no_run - /// # #![allow(dead_code)] + /// # #![expect(dead_code)] /// # use aya_ebpf::{programs::BtfTracePointContext, cty::{c_int, c_ulong, c_char}}; /// unsafe fn try_tp_btf_sched_process_fork(ctx: BtfTracePointContext) -> Result { /// // Grab arguments diff --git a/init/src/main.rs b/init/src/main.rs index f5cfc93c..bf7b3b2e 100644 --- a/init/src/main.rs +++ b/init/src/main.rs @@ -141,7 +141,7 @@ fn run() -> anyhow::Result<()> { .filter_map(|result| { // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this allowance // when the lint behaves more sensibly. - #[allow(clippy::manual_ok_err)] + #[expect(clippy::manual_ok_err)] match result { Ok(()) => None, Err(err) => Some(err), diff --git a/xtask/src/public_api.rs b/xtask/src/public_api.rs index 4eeaaa9c..7605f690 100644 --- a/xtask/src/public_api.rs +++ b/xtask/src/public_api.rs @@ -80,7 +80,7 @@ pub fn public_api(options: Options, metadata: Metadata) -> Result<()> { .filter_map(|result| { // TODO(https://github.com/rust-lang/rust-clippy/issues/14112): Remove this allowance // when the lint behaves more sensibly. - #[allow(clippy::manual_ok_err)] + #[expect(clippy::manual_ok_err)] match result { Ok(()) => None, Err(err) => Some(err), diff --git a/xtask/src/run.rs b/xtask/src/run.rs index a6f919f5..03870b55 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -84,7 +84,7 @@ where let stdout = BufReader::new(stdout); let mut executables = Vec::new(); for message in Message::parse_stream(stdout) { - #[allow(clippy::collapsible_match)] + #[expect(clippy::collapsible_match)] match message.context("valid JSON")? { Message::CompilerArtifact(Artifact { executable,