Merge pull request #580 from mahkoh/jorth/clippy-6
all: address clippy lints
This commit is contained in:
commit
e0d1ab8122
29 changed files with 31 additions and 68 deletions
|
|
@ -1,7 +1,6 @@
|
|||
pub mod client;
|
||||
pub mod ipc;
|
||||
mod logging;
|
||||
pub(crate) mod string_error;
|
||||
|
||||
use {
|
||||
crate::{
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
use std::{
|
||||
error::Error,
|
||||
fmt::{Display, Formatter},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct StringError(pub String);
|
||||
|
||||
impl Display for StringError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for StringError {}
|
||||
|
|
@ -466,7 +466,7 @@ impl Client {
|
|||
self.checking_queue_size.set(false);
|
||||
}
|
||||
|
||||
pub fn lock_registries(&self) -> Locked<WlRegistryId, Rc<WlRegistry>> {
|
||||
pub fn lock_registries(&self) -> Locked<'_, WlRegistryId, Rc<WlRegistry>> {
|
||||
self.objects.registries()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ impl Objects {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn registries(&self) -> Locked<WlRegistryId, Rc<WlRegistry>> {
|
||||
pub fn registries(&self) -> Locked<'_, WlRegistryId, Rc<WlRegistry>> {
|
||||
self.registries.lock()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_or_create(&self, target: &Target) -> RefMut<CritUpstreamNodeData<Target, T>>
|
||||
pub fn get_or_create(&self, target: &Target) -> RefMut<'_, CritUpstreamNodeData<Target, T>>
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
|
|
@ -162,7 +162,7 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get(&self, target: &Target) -> Option<RefMut<CritUpstreamNodeData<Target, T>>> {
|
||||
pub fn get(&self, target: &Target) -> Option<RefMut<'_, CritUpstreamNodeData<Target, T>>> {
|
||||
self.nodes.get(target)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use {
|
|||
std::{
|
||||
cell::Cell,
|
||||
rc::{Rc, Weak},
|
||||
slice,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -86,7 +87,7 @@ where
|
|||
targets: CritPerTargetData::new(slf, id),
|
||||
on_match: Box::new(on_match),
|
||||
events: mgr.leaf_events().clone(),
|
||||
upstream: CritDownstreamData::new(id, &[upstream.clone()]),
|
||||
upstream: CritDownstreamData::new(id, slice::from_ref(upstream)),
|
||||
});
|
||||
slf.upstream.attach(&slf);
|
||||
slf
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ where
|
|||
self.data.borrow_mut().clear();
|
||||
}
|
||||
|
||||
pub fn get_or_create(&self, target: &Target, default: impl FnOnce() -> T) -> RefMut<T> {
|
||||
pub fn get_or_create(&self, target: &Target, default: impl FnOnce() -> T) -> RefMut<'_, T> {
|
||||
RefMut::map(self.data.borrow_mut(), |d| {
|
||||
&mut d
|
||||
.entry(target.id())
|
||||
|
|
@ -75,7 +75,7 @@ where
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get(&self, target: &Target) -> Option<RefMut<T>> {
|
||||
pub fn get(&self, target: &Target) -> Option<RefMut<'_, T>> {
|
||||
RefMut::filter_map(self.data.borrow_mut(), |d| {
|
||||
d.get_mut(&target.id()).map(|d| &mut d.data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use {
|
|||
state::State,
|
||||
tree::{ToplevelData, ToplevelNodeBase},
|
||||
},
|
||||
std::rc::Rc,
|
||||
std::{rc::Rc, slice},
|
||||
};
|
||||
|
||||
pub struct TlmMatchClient {
|
||||
|
|
@ -32,7 +32,7 @@ impl TlmMatchClient {
|
|||
id,
|
||||
state: state.clone(),
|
||||
node: node.clone(),
|
||||
upstream: CritDownstreamData::new(id, &[node.clone()]),
|
||||
upstream: CritDownstreamData::new(id, slice::from_ref(node)),
|
||||
downstream: CritUpstreamData::new(slf, id),
|
||||
});
|
||||
slf.upstream.attach(&slf);
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ pub unsafe trait DbusType<'a>: Clone + 'a {
|
|||
type Generic<'b>: DbusType<'b> + 'b;
|
||||
|
||||
fn consume_signature(s: &mut &[u8]) -> Result<(), DbusError>;
|
||||
#[expect(dead_code)]
|
||||
fn write_signature(w: &mut Vec<u8>);
|
||||
fn marshal(&self, fmt: &mut Formatter);
|
||||
fn unmarshal(parser: &mut Parser<'a>) -> Result<Self, DbusError>;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ impl VulkanAllocation {
|
|||
Ok(f(self.mem.unwrap(), self.size as usize))
|
||||
}
|
||||
|
||||
fn incoherent_range(&self, mask: u64) -> MappedMemoryRange {
|
||||
fn incoherent_range(&self, mask: u64) -> MappedMemoryRange<'static> {
|
||||
MappedMemoryRange::default()
|
||||
.memory(self.memory)
|
||||
.offset(self.offset & !mask)
|
||||
|
|
|
|||
|
|
@ -751,7 +751,7 @@ fn image_create_info(
|
|||
height: u32,
|
||||
format: &Format,
|
||||
usage: BufferUsage,
|
||||
) -> ImageCreateInfo {
|
||||
) -> ImageCreateInfo<'_> {
|
||||
let usage = map_usage(usage);
|
||||
ImageCreateInfo::default()
|
||||
.image_type(ImageType::TYPE_2D)
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ impl Globals {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn lock_seats(&self) -> Locked<GlobalName, Rc<WlSeatGlobal>> {
|
||||
pub fn lock_seats(&self) -> Locked<'_, GlobalName, Rc<WlSeatGlobal>> {
|
||||
self.seats.lock()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use {
|
|||
wire::{WlCallbackId, wl_callback::*},
|
||||
},
|
||||
std::{convert::Infallible, rc::Rc},
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct WlCallback {
|
||||
|
|
@ -44,6 +43,3 @@ object_base! {
|
|||
impl Object for WlCallback {}
|
||||
|
||||
simple_add_obj!(WlCallback);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlCallbackError {}
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ impl XdgSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn pending(&self) -> RefMut<Box<PendingXdgSurfaceData>> {
|
||||
fn pending(&self) -> RefMut<'_, Box<PendingXdgSurfaceData>> {
|
||||
RefMut::map(self.surface.pending.borrow_mut(), |p| {
|
||||
p.xdg_surface.get_or_insert_default_ext()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ use {
|
|||
},
|
||||
ahash::{AHashMap, AHashSet},
|
||||
jay_config::window::TileState,
|
||||
num_derive::FromPrimitive,
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
fmt::{Debug, Formatter},
|
||||
|
|
@ -46,19 +45,6 @@ use {
|
|||
thiserror::Error,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, Debug, FromPrimitive)]
|
||||
pub enum ResizeEdge {
|
||||
None = 0,
|
||||
Top = 1,
|
||||
Bottom = 2,
|
||||
Left = 4,
|
||||
TopLeft = 5,
|
||||
BottomLeft = 6,
|
||||
Right = 8,
|
||||
TopRight = 9,
|
||||
BottomRight = 10,
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
const STATE_MAXIMIZED: u32 = 1;
|
||||
const STATE_FULLSCREEN: u32 = 2;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ impl ZwlrLayerSurfaceV1 {
|
|||
self.client.event(Closed { self_id: self.id });
|
||||
}
|
||||
|
||||
fn pending(&self) -> RefMut<Box<PendingLayerSurfaceData>> {
|
||||
fn pending(&self) -> RefMut<'_, Box<PendingLayerSurfaceData>> {
|
||||
RefMut::map(self.surface.pending.borrow_mut(), |m| {
|
||||
m.layer_surface.get_or_insert_default_ext()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use {
|
|||
wire::{WpPresentationFeedbackId, wp_presentation_feedback::*},
|
||||
},
|
||||
std::{convert::Infallible, rc::Rc},
|
||||
thiserror::Error,
|
||||
};
|
||||
|
||||
pub struct WpPresentationFeedback {
|
||||
|
|
@ -62,6 +61,3 @@ object_base! {
|
|||
impl Object for WpPresentationFeedback {}
|
||||
|
||||
simple_add_obj!(WpPresentationFeedback);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WpPresentationFeedbackError {}
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ impl IoUringData {
|
|||
encoded as usize
|
||||
}
|
||||
|
||||
fn id(&self) -> Cancellable {
|
||||
fn id(&self) -> Cancellable<'_> {
|
||||
Cancellable {
|
||||
id: self.id_raw(),
|
||||
data: self,
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ impl LibInput {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn event(&self) -> Option<LibInputEvent> {
|
||||
pub fn event(&self) -> Option<LibInputEvent<'_>> {
|
||||
let res = unsafe { libinput_get_event(self.li) };
|
||||
if res.is_null() {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ impl<'a> LibInputTabletPadModeGroup<'a> {
|
|||
}
|
||||
|
||||
impl RegisteredDevice {
|
||||
pub fn device(&self) -> LibInputDevice {
|
||||
pub fn device(&self) -> LibInputDevice<'_> {
|
||||
LibInputDevice {
|
||||
dev: self.dev,
|
||||
_phantom: Default::default(),
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ impl<'a> Drop for LibInputEvent<'a> {
|
|||
|
||||
macro_rules! converter {
|
||||
($name:ident, $out:ident, $f:ident) => {
|
||||
pub fn $name(&self) -> Option<$out> {
|
||||
pub fn $name(&self) -> Option<$out<'_>> {
|
||||
let res = unsafe { $f(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
|
|
@ -129,7 +129,7 @@ impl<'a> LibInputEvent<'a> {
|
|||
unsafe { EventType(libinput_event_get_type(self.event)) }
|
||||
}
|
||||
|
||||
pub fn device(&self) -> LibInputDevice {
|
||||
pub fn device(&self) -> LibInputDevice<'_> {
|
||||
LibInputDevice {
|
||||
dev: unsafe { libinput_event_get_device(self.event) },
|
||||
_phantom: Default::default(),
|
||||
|
|
@ -491,7 +491,7 @@ impl<'a> LibInputEventTabletPad<'a> {
|
|||
unsafe { libinput_event_tablet_pad_get_mode(self.event) as u32 }
|
||||
}
|
||||
|
||||
pub fn mode_group(&self) -> LibInputTabletPadModeGroup {
|
||||
pub fn mode_group(&self) -> LibInputTabletPadModeGroup<'_> {
|
||||
LibInputTabletPadModeGroup {
|
||||
group: unsafe { libinput_event_tablet_pad_get_mode_group(self.event) },
|
||||
_phantom: Default::default(),
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ impl<'a> PwParser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn read_object_opt(&mut self) -> Result<Option<PwPodObject>, PwParserError> {
|
||||
pub fn read_object_opt(&mut self) -> Result<Option<PwPodObject<'_>>, PwParserError> {
|
||||
match self.read_pod()? {
|
||||
PwPod::Object(p) => Ok(Some(p)),
|
||||
PwPod::None => Ok(None),
|
||||
|
|
@ -122,7 +122,7 @@ impl<'a> PwParser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn read_object(&mut self) -> Result<PwPodObject, PwParserError> {
|
||||
pub fn read_object(&mut self) -> Result<PwPodObject<'_>, PwParserError> {
|
||||
match self.read_object_opt()? {
|
||||
Some(p) => Ok(p),
|
||||
_ => Err(PwParserError::UnexpectedPodType(
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ impl UdevEnumerate {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_list_entry(&mut self) -> Result<Option<UdevListEntry>, UdevError> {
|
||||
pub fn get_list_entry(&mut self) -> Result<Option<UdevListEntry<'_>>, UdevError> {
|
||||
let res = unsafe { udev_enumerate_get_list_entry(self.enumerate) };
|
||||
if res.is_null() {
|
||||
let err = Errno::default();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl AsyncEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn triggered(&self) -> AsyncEventTriggered {
|
||||
pub fn triggered(&self) -> AsyncEventTriggered<'_> {
|
||||
AsyncEventTriggered { ae: self }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl<P: Object> Bindings<P> {
|
|||
self.bindings.clear();
|
||||
}
|
||||
|
||||
pub fn lock(&self) -> Locked<(ClientId, ObjectId), Rc<P>> {
|
||||
pub fn lock(&self) -> Locked<'_, (ClientId, ObjectId), Rc<P>> {
|
||||
self.bindings.lock()
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ impl<P: Object> PerClientBindings<P> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn borrow(&self) -> Ref<AHashMap<ClientId, AHashMap<ObjectId, Rc<P>>>> {
|
||||
pub fn borrow(&self) -> Ref<'_, AHashMap<ClientId, AHashMap<ObjectId, Rc<P>>>> {
|
||||
self.bindings.borrow()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#[expect(dead_code)]
|
||||
pub struct LogOnDrop(pub &'static str);
|
||||
|
||||
impl Drop for LogOnDrop {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ impl<T: Eq> RefCounted<T> {
|
|||
unsafe { self.map.get().deref().iter().map(|k| k.0).collect() }
|
||||
}
|
||||
|
||||
pub fn lock(&self) -> Locked<T> {
|
||||
pub fn lock(&self) -> Locked<'_, T> {
|
||||
unsafe {
|
||||
Locked {
|
||||
vec: mem::take(self.map.get().deref_mut()),
|
||||
|
|
|
|||
|
|
@ -802,6 +802,7 @@ pub struct DrmVersion {
|
|||
pub desc: BString,
|
||||
}
|
||||
|
||||
#[expect(dead_code)]
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct HdrMetadata {
|
||||
pub eotf: u8,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,3 @@ fn GetSession(
|
|||
) {
|
||||
object_path: object_path,
|
||||
}
|
||||
|
||||
prop BootLoaderEntries = array(string)
|
||||
prop ScheduledShutdown = struct(string, u64)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue