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

@ -201,7 +201,7 @@ impl PwCon {
});
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn sync<P: PwObject>(&self, p: &P) {
let seq = p.data().sync_id.fetch_add(1) + 1;
self.send2(0, "core", PwCoreMethods::Sync, |f| {
@ -218,7 +218,7 @@ impl PwCon {
});
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn get_registry(self: &Rc<Self>) -> Rc<PwRegistry> {
let registry = Rc::new(PwRegistry {
data: self.proxy_data(),

View file

@ -92,7 +92,7 @@ impl<'a> PwFormatter<'a> {
self.first = false;
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_float(&mut self, float: f32) {
if !self.array || self.first {
self.data.extend_from_slice(uapi::as_bytes(&4u32));
@ -106,7 +106,7 @@ impl<'a> PwFormatter<'a> {
self.first = false;
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_double(&mut self, double: f64) {
if !self.array || self.first {
self.data.extend_from_slice(uapi::as_bytes(&8u32));
@ -127,7 +127,7 @@ impl<'a> PwFormatter<'a> {
self.pad();
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_bytes(&mut self, s: &[u8]) {
self.data
.extend_from_slice(uapi::as_bytes(&(s.len() as u32)));
@ -148,7 +148,7 @@ impl<'a> PwFormatter<'a> {
self.first = false;
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_fraction(&mut self, num: i32, denom: i32) {
if !self.array || self.first {
self.data.extend_from_slice(uapi::as_bytes(&8u32));
@ -168,7 +168,7 @@ impl<'a> PwFormatter<'a> {
self.first = false;
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_bitmap(&mut self, s: &[u8]) {
self.data
.extend_from_slice(uapi::as_bytes(&(s.len() as u32)));
@ -178,7 +178,6 @@ impl<'a> PwFormatter<'a> {
self.pad();
}
#[allow(dead_code)]
pub fn write_fd(&mut self, fd: &Rc<OwnedFd>) {
let pos = self.fds.len() as u64;
self.fds.push(fd.clone());
@ -205,7 +204,7 @@ impl<'a> PwFormatter<'a> {
});
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn write_array<F>(&mut self, f: F)
where
F: FnOnce(&mut PwFormatter),

View file

@ -202,12 +202,12 @@ pub const PW_CLIENT_NODE_FACTORY: &str = "client-node";
pub const PW_CLIENT_NODE_INTERFACE: &str = "PipeWire:Interface:ClientNode";
pub const PW_CLIENT_NODE_VERSION: i32 = 4;
#[allow(dead_code)]
#[expect(dead_code)]
const PW_CLIENT_NODE_UPDATE_PARAMS: u32 = 1 << 0;
const PW_CLIENT_NODE_UPDATE_INFO: u32 = 1 << 1;
const SPA_NODE_CHANGE_MASK_FLAGS: u64 = 1 << 0;
#[allow(dead_code)]
#[expect(dead_code)]
const SPA_NODE_CHANGE_MASK_PROPS: u64 = 1 << 1;
const SPA_NODE_CHANGE_MASK_PARAMS: u64 = 1 << 2;
@ -216,7 +216,7 @@ const PW_CLIENT_NODE_PORT_UPDATE_INFO: u32 = 1 << 1;
const SPA_PORT_CHANGE_MASK_FLAGS: u64 = 1 << 0;
const SPA_PORT_CHANGE_MASK_RATE: u64 = 1 << 1;
#[allow(dead_code)]
#[expect(dead_code)]
const SPA_PORT_CHANGE_MASK_PROPS: u64 = 1 << 2;
const SPA_PORT_CHANGE_MASK_PARAMS: u64 = 1 << 3;

View file

@ -41,7 +41,7 @@ pub struct PwMemTyped<T> {
_phantom: PhantomData<T>,
}
#[allow(dead_code)]
#[expect(dead_code)]
pub struct PwMemSlice {
mem: Rc<PwMemMap>,
range: Range<usize>,
@ -85,19 +85,19 @@ impl PwMem {
}
impl PwMemMap {
#[allow(dead_code)]
#[expect(dead_code)]
pub unsafe fn read<T: Pod>(&self) -> &T {
self.check::<T>(0);
(self.map.ptr.cast::<u8>().add(self.range.start) as *const T).deref()
}
#[allow(dead_code)]
#[expect(dead_code)]
pub unsafe fn write<T: Pod>(&self) -> &mut T {
self.check::<T>(0);
(self.map.ptr.cast::<u8>().add(self.range.start) as *mut T).deref_mut()
}
#[allow(dead_code)]
#[expect(dead_code)]
pub unsafe fn bytes_mut(&self) -> &mut [u8] {
std::slice::from_raw_parts_mut(
self.map.ptr.cast::<u8>().add(self.range.start) as _,
@ -135,7 +135,6 @@ impl PwMemMap {
}
impl<T: Pod> PwMemTyped<T> {
#[allow(dead_code)]
pub unsafe fn read(&self) -> &T {
(self.mem.map.ptr.cast::<u8>().add(self.offset) as *const T).deref()
}