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

@ -47,7 +47,7 @@ pub struct DefaultSeat {
}
impl TestClient {
#[allow(dead_code)]
#[expect(dead_code)]
pub fn error(&self, msg: &str) {
self.tran.error(msg)
}
@ -97,7 +97,7 @@ impl TestClient {
Ok(qoi)
}
#[allow(dead_code)]
#[expect(dead_code)]
pub async fn save_screenshot(&self, name: &str, include_cursor: bool) -> Result<(), TestError> {
let qoi = self.take_screenshot(include_cursor).await?;
let path = format!("{}/screenshot_{}.qoi", self.run.out_dir, name);

View file

@ -13,7 +13,7 @@ pub struct TestCursorShapeDevice {
}
impl TestCursorShapeDevice {
#[allow(dead_code)]
#[expect(dead_code)]
pub fn destroy(&self) -> TestResult {
if !self.destroyed.replace(true) {
self.tran.send(Destroy { self_id: self.id })?;

View file

@ -28,7 +28,7 @@ impl TestCursorShapeManager {
}
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn destroy(&self) -> TestResult {
if !self.destroyed.replace(true) {
self.tran.send(Destroy { self_id: self.id })?;

View file

@ -29,7 +29,7 @@ pub struct TestDataControlDevice {
}
impl TestDataControlDevice {
#[allow(dead_code)]
#[expect(dead_code)]
pub fn destroy(&self) -> TestResult {
if !self.destroyed.replace(true) {
self.tran.send(Destroy { self_id: self.id })?;
@ -45,7 +45,7 @@ impl TestDataControlDevice {
Ok(())
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn set_primary_selection(&self, source: &TestDataControlSource) -> TestResult {
self.tran.send(SetPrimarySelection {
self_id: self.id,

View file

@ -47,7 +47,6 @@ impl TestDataDevice {
Ok(())
}
#[allow(dead_code)]
pub fn set_selection(&self, source: &TestDataSource, serial: u32) -> TestResult {
self.tran.send(SetSelection {
self_id: self.id,

View file

@ -26,7 +26,6 @@ impl TestDataSource {
Ok(())
}
#[allow(dead_code)]
pub fn offer(&self, mime_type: &str) -> TestResult {
self.tran.send(Offer {
self_id: self.id,
@ -35,7 +34,6 @@ impl TestDataSource {
Ok(())
}
#[allow(dead_code)]
pub fn set_actions(&self, actions: u32) -> TestResult {
self.tran.send(SetActions {
self_id: self.id,

View file

@ -33,7 +33,7 @@ impl TestDmabuf {
Ok(())
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn get_default_feedback(&self) -> TestResult<Rc<TestDmabufFeedback>> {
let obj = Rc::new(TestDmabufFeedback::new(&self.tran));
self.tran.add_obj(obj.clone())?;

View file

@ -33,7 +33,7 @@ impl TestExtForeignToplevelList {
}
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn stop(&self) -> TestResult {
self.tran.send(Stop { self_id: self.id })?;
Ok(())

View file

@ -41,7 +41,7 @@ impl TestInputMethod {
})
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn grab(&self) -> TestResult<Rc<TestInputMethodKeyboardGrab>> {
let obj = Rc::new(TestInputMethodKeyboardGrab {
id: self.tran.id(),

View file

@ -39,7 +39,6 @@ impl TestShm {
&self.formats
}
#[allow(dead_code)]
pub fn create_pool(&self, size: usize) -> Result<Rc<TestShmPool>, TestError> {
let mem = TestMem::new(size)?;
let pool = Rc::new(TestShmPool {
@ -58,7 +57,6 @@ impl TestShm {
Ok(pool)
}
#[allow(dead_code)]
pub fn create_buffer(&self, width: i32, height: i32) -> TestResult<Rc<TestShmBuffer>> {
let pool = self.create_pool((width * height * 4) as _)?;
pool.create_buffer(0, width, height, width * 4, ARGB8888)

View file

@ -18,7 +18,6 @@ pub struct TestShmBuffer {
}
impl TestShmBuffer {
#[allow(dead_code)]
pub fn fill(&self, color: Color) {
let [cr, cg, cb, ca] = color.to_rgba_premultiplied();
for [b, g, r, a] in self.deref().array_chunks_ext::<4>() {

View file

@ -22,7 +22,6 @@ pub struct TestShmPool {
}
impl TestShmPool {
#[allow(dead_code)]
pub fn create_buffer(
&self,
offset: i32,
@ -61,7 +60,7 @@ impl TestShmPool {
Ok(buffer)
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn resize(&self, size: usize) -> Result<(), TestError> {
let mem = self.mem.get().grow(size)?;
self.mem.set(mem);

View file

@ -44,12 +44,11 @@ impl TestSubsurface {
})
}
#[allow(dead_code)]
#[expect(dead_code)]
pub fn set_sync(&self) -> Result<(), TestError> {
self.tran.send(SetSync { self_id: self.id })
}
#[allow(dead_code)]
pub fn set_desync(&self) -> Result<(), TestError> {
self.tran.send(SetDesync { self_id: self.id })
}

View file

@ -13,7 +13,6 @@ pub struct TestMem {
}
impl TestMem {
#[allow(dead_code)]
pub fn new(size: usize) -> Result<Rc<Self>, TestError> {
let fd = uapi::memfd_create("test_pool", c::MFD_CLOEXEC | c::MFD_ALLOW_SEALING)?;
uapi::fcntl_add_seals(fd.raw(), c::F_SEAL_SHRINK)?;
@ -25,7 +24,6 @@ impl TestMem {
}))
}
#[allow(dead_code)]
pub fn grow(&self, size: usize) -> Result<Rc<Self>, TestError> {
let cur_len = uapi::fstat(self.fd.raw())?;
if size > cur_len.st_size as _ {
@ -47,7 +45,6 @@ impl Deref for TestMem {
}
}
#[allow(dead_code)]
fn map(fd: c::c_int, size: usize) -> Result<*const [Cell<u8>], TestError> {
if size == 0 {
return Ok(&[]);

View file

@ -14,7 +14,7 @@ macro_rules! test_object {
self.id.into()
}
#[allow(unused_variables, unreachable_code)]
#[allow(clippy::allow_attributes, unused_variables, unreachable_code)]
fn handle_request(
self: std::rc::Rc<Self>,
request: u32,

View file

@ -17,7 +17,6 @@ impl<T> TestExpectedEvent<T> {
}
}
#[allow(dead_code)]
pub fn last(&self) -> TestResult<T> {
match self.data.events.borrow_mut().pop_back() {
Some(t) => Ok(t),

View file

@ -38,7 +38,6 @@ impl TestSurfaceExt {
Ok(())
}
#[allow(dead_code)]
pub fn set_color(&self, r: u8, g: u8, b: u8, a: u8) {
self.color.set(Color::from_rgba_straight(r, g, b, a));
}