1
0
Fork 0
forked from wry/wry

all: use expect attribute where possible

This commit is contained in:
Julian Orth 2024-09-06 11:08:22 +02:00
parent c3b50dc653
commit e377470f3f
134 changed files with 241 additions and 296 deletions

View file

@ -42,7 +42,7 @@ impl<'a> EiMsgFormatter<'a> {
self
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn long(&mut self, int: i64) -> &mut Self {
self.write(uapi::as_bytes(&int));
self

View file

@ -79,7 +79,7 @@ impl<'a> MsgFormatter<'a> {
self.object(obj).uint(event)
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn array<F: FnOnce(&mut MsgFormatter<'_>)>(&mut self, f: F) -> &mut Self {
let pos = self.meta.write_pos;
self.uint(0);

View file

@ -59,12 +59,11 @@ impl<'a, 'b> MsgParser<'a, 'b> {
self.int().map(|i| ObjectId::from_raw(i as u32).into())
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn global(&mut self) -> Result<GlobalName, MsgParserError> {
self.int().map(|i| GlobalName::from_raw(i as u32))
}
#[allow(dead_code)]
pub fn fixed(&mut self) -> Result<Fixed, MsgParserError> {
self.int().map(Fixed)
}

View file

@ -5,7 +5,7 @@ use {
};
#[derive(Default, Copy, Clone)]
#[allow(non_camel_case_types, dead_code)]
#[expect(non_camel_case_types, dead_code)]
struct clone_args {
flags: u64,
pidfd: u64,

View file

@ -66,7 +66,6 @@ impl<T> CloneCell<Option<T>> {
}
#[inline(always)]
#[allow(dead_code)]
pub fn is_none(&self) -> bool {
unsafe { self.data.get().deref().is_none() }
}

View file

@ -74,7 +74,6 @@ impl<T> LinkedList<T> {
unsafe { self.endpoint(self.root.data.as_ref().prev.get()) }
}
#[allow(dead_code)]
pub fn first(&self) -> Option<NodeRef<T>> {
unsafe { self.endpoint(self.root.data.as_ref().next.get()) }
}
@ -91,7 +90,7 @@ impl<T> LinkedList<T> {
self.root.prepend_existing(t)
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn add_first_existing(&self, t: &NodeRef<T>) {
self.root.append_existing(t)
}

View file

@ -4,7 +4,7 @@ use {
uapi::{c, Errno},
};
#[allow(dead_code)]
#[cfg_attr(not(feature = "it"), expect(dead_code))]
pub fn num_cpus() -> Result<u32, OsError> {
let mut buf: SmallVec<[usize; 32]> = smallvec_inline![0; 32];
loop {

View file

@ -205,7 +205,7 @@ impl Display for OsError {
}
}
#[cfg_attr(not(feature = "it"), allow(dead_code))]
#[cfg_attr(not(feature = "it"), expect(dead_code))]
pub trait OsErrorExt {
type Container;

View file

@ -38,7 +38,7 @@ impl TimerFd {
})
}
#[allow(clippy::await_holding_refcell_ref)]
#[expect(clippy::await_holding_refcell_ref)]
pub async fn expired(&self, ring: &IoUring) -> Result<u64, TimerError> {
let mut buf = self.buf.borrow_mut();
if let Err(e) = ring.read(&self.fd, buf.buf()).await {

View file

@ -10,7 +10,7 @@ pub trait Try: Sized {
where
F: FnOnce() -> Result<(), Self>;
#[allow(dead_code)]
#[expect(dead_code)]
fn tria<F>(f: F) -> Tria<Self, F>
where
F: Future<Output = Result<(), Self>>;

View file

@ -19,7 +19,7 @@ impl<T> Deref for VecSet<T> {
}
impl<T> VecSet<T> {
#[allow(dead_code)]
#[expect(dead_code)]
pub fn clear(&mut self) {
self.vec.clear();
}

View file

@ -19,7 +19,6 @@ impl<T> Default for VecStorage<T> {
}
impl<T> VecStorage<T> {
#[allow(dead_code)]
pub fn take<'a>(&'a mut self) -> RealizedVec<'a, T, T> {
self.take_as()
}

View file

@ -1,13 +1,12 @@
use crate::utils::ptr_ext::PtrExt;
#[cfg_attr(not(feature = "it"), allow(dead_code))]
pub trait WindowsExt<T> {
type Windows<'a, const N: usize>: Iterator<Item = &'a [T; N]>
where
Self: 'a,
T: 'a;
#[cfg_attr(not(feature = "rc_tracking"), allow(dead_code))]
#[cfg_attr(not(feature = "rc_tracking"), expect(dead_code))]
fn array_windows_ext<'a, const N: usize>(&'a self) -> Self::Windows<'a, N>;
fn array_chunks_ext<'a, const N: usize>(&'a self) -> &'a [[T; N]];
}