Browse Source

Use #[expect(...)] rather than #[allow(...)]

This is stricter, and revealed a few unused allowances.
Tamir Duberstein 3 weeks ago
parent
commit
4101a5a55d
47 changed files with 80 additions and 98 deletions
  1. 1 1
      aya-build/src/lib.rs
  2. 0 1
      aya-ebpf-macros/src/kprobe.rs
  3. 2 2
      aya-ebpf-macros/src/lib.rs
  4. 0 1
      aya-ebpf-macros/src/sk_skb.rs
  5. 0 1
      aya-ebpf-macros/src/uprobe.rs
  6. 1 1
      aya-log-common/src/lib.rs
  7. 2 2
      aya-log/src/lib.rs
  8. 0 1
      aya-obj/src/btf/btf.rs
  9. 1 1
      aya-obj/src/btf/mod.rs
  10. 0 2
      aya-obj/src/btf/relocation.rs
  11. 1 2
      aya-obj/src/btf/types.rs
  12. 0 8
      aya-obj/src/generated/mod.rs
  13. 2 1
      aya-obj/src/lib.rs
  14. 0 1
      aya-obj/src/maps.rs
  15. 3 4
      aya-obj/src/obj.rs
  16. 2 2
      aya/src/lib.rs
  17. 1 1
      aya/src/maps/array/mod.rs
  18. 1 1
      aya/src/maps/hash_map/mod.rs
  19. 1 1
      aya/src/maps/ring_buf.rs
  20. 0 1
      aya/src/programs/perf_event.rs
  21. 1 1
      aya/src/programs/probe.rs
  22. 2 2
      aya/src/sys/mod.rs
  23. 1 1
      aya/src/sys/perf_event.rs
  24. 1 1
      aya/src/util.rs
  25. 0 1
      ebpf/aya-ebpf-bindings/src/aarch64/mod.rs
  26. 0 1
      ebpf/aya-ebpf-bindings/src/armv7/mod.rs
  27. 7 1
      ebpf/aya-ebpf-bindings/src/lib.rs
  28. 0 1
      ebpf/aya-ebpf-bindings/src/mips/mod.rs
  29. 0 1
      ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs
  30. 0 1
      ebpf/aya-ebpf-bindings/src/riscv64/mod.rs
  31. 0 1
      ebpf/aya-ebpf-bindings/src/s390x/mod.rs
  32. 0 1
      ebpf/aya-ebpf-bindings/src/x86_64/mod.rs
  33. 1 1
      ebpf/aya-ebpf-cty/src/lib.rs
  34. 18 18
      ebpf/aya-ebpf/src/helpers.rs
  35. 3 3
      ebpf/aya-ebpf/src/lib.rs
  36. 1 1
      ebpf/aya-ebpf/src/maps/program_array.rs
  37. 2 2
      ebpf/aya-ebpf/src/programs/fentry.rs
  38. 2 2
      ebpf/aya-ebpf/src/programs/fexit.rs
  39. 1 1
      ebpf/aya-ebpf/src/programs/lsm.rs
  40. 2 2
      ebpf/aya-ebpf/src/programs/probe.rs
  41. 1 1
      ebpf/aya-ebpf/src/programs/retprobe.rs
  42. 8 8
      ebpf/aya-ebpf/src/programs/sk_buff.rs
  43. 7 7
      ebpf/aya-ebpf/src/programs/tc.rs
  44. 1 1
      ebpf/aya-ebpf/src/programs/tp_btf.rs
  45. 1 1
      init/src/main.rs
  46. 1 1
      xtask/src/public_api.rs
  47. 1 1
      xtask/src/run.rs

+ 1 - 1
aya-build/src/lib.rs

@@ -104,7 +104,7 @@ pub fn build_ebpf(packages: impl IntoIterator<Item = Package>) -> 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,

+ 0 - 1
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,

+ 2 - 2
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;

+ 0 - 1
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,

+ 0 - 1
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,

+ 1 - 1
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<NonZeroUsize> {
     // 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,

+ 2 - 2
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);

+ 0 - 1
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,

+ 1 - 1
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;

+ 0 - 2
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<Relocation, BtfError> {
         if mem::size_of::<bpf_core_relo>() > 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;

+ 1 - 2
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<T>(data: &[u8], len: usize) -> Result<Vec<T>, BtfError> {
 }
 
 impl BtfType {
-    #[allow(unused_unsafe)]
     pub(crate) unsafe fn read(data: &[u8], endianness: Endianness) -> Result<BtfType, BtfError> {
         let ty = unsafe { read_array::<u32>(data, 3)? };
         let data = &data[mem::size_of::<u32>() * 3..];

+ 0 - 8
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;

+ 2 - 1
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;

+ 0 - 1
aya-obj/src/maps.rs

@@ -107,7 +107,6 @@ impl TryFrom<u32> 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 {

+ 3 - 4
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),

+ 2 - 2
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;

+ 1 - 1
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;

+ 1 - 1
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;
 

+ 1 - 1
aya/src/maps/ring_buf.rs

@@ -121,7 +121,7 @@ impl<T> RingBuf<T> {
     // 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<RingBufItem<'_>> {
         let Self {
             consumer, producer, ..

+ 0 - 1
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,

+ 1 - 1
aya/src/programs/probe.rs

@@ -62,7 +62,7 @@ pub(crate) fn lines(bytes: &[u8]) -> impl Iterator<Item = &OsStr> {
 
 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>;

+ 2 - 2
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);

+ 1 - 1
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,

+ 1 - 1
aya/src/util.rs

@@ -298,7 +298,7 @@ fn parse_kernel_symbols(reader: impl BufRead) -> Result<BTreeMap<u64, String>, 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,

+ 0 - 1
ebpf/aya-ebpf-bindings/src/aarch64/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 0 - 1
ebpf/aya-ebpf-bindings/src/armv7/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 7 - 1
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]
 

+ 0 - 1
ebpf/aya-ebpf-bindings/src/mips/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 0 - 1
ebpf/aya-ebpf-bindings/src/powerpc64/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 0 - 1
ebpf/aya-ebpf-bindings/src/riscv64/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 0 - 1
ebpf/aya-ebpf-bindings/src/s390x/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 0 - 1
ebpf/aya-ebpf-bindings/src/x86_64/mod.rs

@@ -1,3 +1,2 @@
-#![allow(clippy::all, dead_code)]
 pub mod bindings;
 pub mod helpers;

+ 1 - 1
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

+ 18 - 18
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<T>(src: *const T) -> Result<T, c_long> {
 /// # 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<T>(src: *const T) -> Result<T, c_long> {
 /// # 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<T>(src: *const T) -> Result<T, c_long> {
 /// # 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<usiz
 /// # Examples
 ///
 /// ```no_run
-/// # #![allow(dead_code)]
+/// # #![expect(dead_code)]
 /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str};
 /// # fn try_test() -> 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<T>(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;

+ 3 - 3
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;

+ 1 - 1
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};
 ///

+ 2 - 2
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 {

+ 2 - 2
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 {

+ 1 - 1
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<i32, i32> {
     ///     // In the kernel, this hook is defined as:

+ 2 - 2
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 {

+ 1 - 1
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<u32, u32> {
     ///     let retval: c_int = ctx.ret().ok_or(1u32)?;

+ 8 - 8
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::<ethhdr>();
@@ -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::<ethhdr>();

+ 7 - 7
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::<ethhdr>();
@@ -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::<ethhdr>();

+ 1 - 1
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<u32, u32> {
     ///     // Grab arguments

+ 1 - 1
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),

+ 1 - 1
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),

+ 1 - 1
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,