diff --git a/build/wire.rs b/build/wire.rs index f6d1979e..e6c597f2 100644 --- a/build/wire.rs +++ b/build/wire.rs @@ -723,6 +723,10 @@ fn write_request_handler( messages: &ParseResult, ) -> Result<()> { writeln!(f)?; + // TODO: remove this after https://github.com/mahkoh/jay/pull/190 + if camel_obj_name == "ZwpTabletToolV2" { + writeln!(f, " #[allow(dead_code)]")?; + } writeln!( f, " pub trait {camel_obj_name}RequestHandler: crate::object::Object + Sized {{" diff --git a/src/backend.rs b/src/backend.rs index f1ded7d8..bfed7dc2 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -24,6 +24,7 @@ linear_ids!(DrmDeviceIds, DrmDeviceId); pub trait Backend { fn run(self: Rc) -> SpawnedFuture>>; + #[cfg_attr(not(feature = "it"), allow(dead_code))] fn into_any(self: Rc) -> Rc; fn switch_to(&self, vtnr: u32) { diff --git a/src/backends/metal/video.rs b/src/backends/metal/video.rs index edf4a611..7fc0531a 100644 --- a/src/backends/metal/video.rs +++ b/src/backends/metal/video.rs @@ -1473,10 +1473,10 @@ fn create_connector_display_data( for descriptor in edid.base_block.descriptors.iter().flatten() { match descriptor { Descriptor::DisplayProductSerialNumber(s) => { - serial_number = s.clone(); + serial_number.clone_from(s); } Descriptor::DisplayProductName(s) => { - name = s.clone(); + name.clone_from(s); } _ => {} } diff --git a/src/gfx_api.rs b/src/gfx_api.rs index cd3cc317..a8f79551 100644 --- a/src/gfx_api.rs +++ b/src/gfx_api.rs @@ -222,8 +222,6 @@ pub enum ResetStatus { } pub trait GfxFramebuffer: Debug { - fn as_any(&self) -> &dyn Any; - fn take_render_ops(&self) -> Vec; fn physical_size(&self) -> (i32, i32); diff --git a/src/gfx_apis/gl/renderer/framebuffer.rs b/src/gfx_apis/gl/renderer/framebuffer.rs index 41a104ac..96d42e08 100644 --- a/src/gfx_apis/gl/renderer/framebuffer.rs +++ b/src/gfx_apis/gl/renderer/framebuffer.rs @@ -15,7 +15,6 @@ use { theme::Color, }, std::{ - any::Any, cell::Cell, fmt::{Debug, Formatter}, mem, @@ -100,10 +99,6 @@ impl Framebuffer { } impl GfxFramebuffer for Framebuffer { - fn as_any(&self) -> &dyn Any { - self - } - fn take_render_ops(&self) -> Vec { mem::take(&mut *self.ctx.gfx_ops.borrow_mut()) } diff --git a/src/gfx_apis/vulkan/device.rs b/src/gfx_apis/vulkan/device.rs index 6649c713..1019f29e 100644 --- a/src/gfx_apis/vulkan/device.rs +++ b/src/gfx_apis/vulkan/device.rs @@ -20,7 +20,7 @@ use { ash::{ extensions::khr::{ExternalFenceFd, ExternalMemoryFd, ExternalSemaphoreFd, PushDescriptor}, vk::{ - DeviceCreateInfo, DeviceMemory, DeviceQueueCreateInfo, ExtExternalMemoryDmaBufFn, + DeviceCreateInfo, DeviceQueueCreateInfo, ExtExternalMemoryDmaBufFn, ExtImageDrmFormatModifierFn, ExtPhysicalDeviceDrmFn, ExtQueueFamilyForeignFn, ExternalSemaphoreFeatureFlags, ExternalSemaphoreHandleTypeFlags, ExternalSemaphoreProperties, KhrDriverPropertiesFn, KhrExternalFenceFdFn, @@ -84,16 +84,6 @@ impl VulkanDevice { } } -struct FreeMem<'a>(&'a Device, DeviceMemory); - -impl<'a> Drop for FreeMem<'a> { - fn drop(&mut self) { - unsafe { - self.0.free_memory(self.1, None); - } - } -} - impl VulkanInstance { fn get_device_extensions(&self, phy_dev: PhysicalDevice) -> Result { unsafe { diff --git a/src/gfx_apis/vulkan/format.rs b/src/gfx_apis/vulkan/format.rs index 79b03c34..f5f425ae 100644 --- a/src/gfx_apis/vulkan/format.rs +++ b/src/gfx_apis/vulkan/format.rs @@ -27,11 +27,6 @@ pub struct VulkanFormat { pub features: FormatFeatureFlags, } -#[derive(Debug)] -pub struct VulkanFormatFeatures { - pub linear_sampling: bool, -} - #[derive(Debug)] pub struct VulkanModifier { pub modifier: Modifier, diff --git a/src/gfx_apis/vulkan/image.rs b/src/gfx_apis/vulkan/image.rs index 0cbe6118..f8f3fa8f 100644 --- a/src/gfx_apis/vulkan/image.rs +++ b/src/gfx_apis/vulkan/image.rs @@ -516,10 +516,6 @@ impl Debug for VulkanImage { } impl GfxFramebuffer for VulkanImage { - fn as_any(&self) -> &dyn Any { - self - } - fn take_render_ops(&self) -> Vec { self.render_ops.take() } diff --git a/src/gfx_apis/vulkan/renderer.rs b/src/gfx_apis/vulkan/renderer.rs index 69a53aa5..2811a57c 100644 --- a/src/gfx_apis/vulkan/renderer.rs +++ b/src/gfx_apis/vulkan/renderer.rs @@ -1023,9 +1023,6 @@ impl Debug for VulkanRenderer { } } -#[derive(Debug)] -pub struct TmpShmTexture(pub i32, pub i32); - impl VulkanImage { fn assert_device(&self, device: &Device) { assert_eq!( diff --git a/src/globals.rs b/src/globals.rs index 8fef5937..2989539b 100644 --- a/src/globals.rs +++ b/src/globals.rs @@ -116,7 +116,6 @@ pub trait GlobalBase { pub trait Global: GlobalBase { fn singleton(&self) -> bool; fn version(&self) -> u32; - fn break_loops(&self) {} fn required_caps(&self) -> ClientCaps { ClientCaps::none() } diff --git a/src/ifs/ipc.rs b/src/ifs/ipc.rs index e7729437..40ea6338 100644 --- a/src/ifs/ipc.rs +++ b/src/ifs/ipc.rs @@ -101,7 +101,6 @@ pub trait DynDataOffer: 'static { fn offer_id(&self) -> DataOfferId; fn client_id(&self) -> ClientId; fn send_offer(&self, mime_type: &str); - fn destroy(&self); fn cancel(&self); fn get_seat(&self) -> Rc; diff --git a/src/ifs/ipc/wl_data_offer.rs b/src/ifs/ipc/wl_data_offer.rs index 20c14796..333b6a7a 100644 --- a/src/ifs/ipc/wl_data_offer.rs +++ b/src/ifs/ipc/wl_data_offer.rs @@ -64,10 +64,6 @@ impl DynDataOffer for WlDataOffer { WlDataOffer::send_offer(self, mime_type); } - fn destroy(&self) { - destroy_data_offer::(self); - } - fn cancel(&self) { cancel_offer::(self); } diff --git a/src/ifs/ipc/x_data_offer.rs b/src/ifs/ipc/x_data_offer.rs index 7b9887dc..4faaf4ef 100644 --- a/src/ifs/ipc/x_data_offer.rs +++ b/src/ifs/ipc/x_data_offer.rs @@ -3,7 +3,7 @@ use { client::ClientId, ifs::{ ipc::{ - cancel_offer, destroy_data_offer, + cancel_offer, x_data_device::{XClipboardIpc, XIpcDevice, XPrimarySelectionIpc}, DataOffer, DataOfferId, DynDataOffer, IpcLocation, OfferData, }, @@ -50,13 +50,6 @@ impl DynDataOffer for XDataOffer { }) } - fn destroy(&self) { - match self.location { - IpcLocation::Clipboard => destroy_data_offer::(self), - IpcLocation::PrimarySelection => destroy_data_offer::(self), - } - } - fn cancel(&self) { match self.location { IpcLocation::Clipboard => cancel_offer::(self), diff --git a/src/ifs/ipc/zwlr_data_control_device_v1.rs b/src/ifs/ipc/zwlr_data_control_device_v1.rs index f5d1e207..01c8f882 100644 --- a/src/ifs/ipc/zwlr_data_control_device_v1.rs +++ b/src/ifs/ipc/zwlr_data_control_device_v1.rs @@ -3,7 +3,7 @@ use { client::{Client, ClientError}, ifs::{ ipc::{ - destroy_data_device, + break_device_loops, destroy_data_device, zwlr_data_control_device_v1::private::{ WlrClipboardIpcCore, WlrIpcImpl, WlrPrimarySelectionIpcCore, }, @@ -282,6 +282,8 @@ object_base! { impl Object for ZwlrDataControlDeviceV1 { fn break_loops(&self) { + break_device_loops::(self); + break_device_loops::(self); self.seat.remove_wlr_device(self); } } diff --git a/src/ifs/ipc/zwlr_data_control_offer_v1.rs b/src/ifs/ipc/zwlr_data_control_offer_v1.rs index 1b8a5358..6307edc1 100644 --- a/src/ifs/ipc/zwlr_data_control_offer_v1.rs +++ b/src/ifs/ipc/zwlr_data_control_offer_v1.rs @@ -50,13 +50,6 @@ impl DynDataOffer for ZwlrDataControlOfferV1 { ZwlrDataControlOfferV1::send_offer(self, mime_type) } - fn destroy(&self) { - match self.location { - IpcLocation::Clipboard => destroy_data_offer::(self), - IpcLocation::PrimarySelection => destroy_data_offer::(self), - } - } - fn cancel(&self) { match self.location { IpcLocation::Clipboard => cancel_offer::(self), diff --git a/src/ifs/ipc/zwp_primary_selection_offer_v1.rs b/src/ifs/ipc/zwp_primary_selection_offer_v1.rs index 7690b4fe..e4a738b5 100644 --- a/src/ifs/ipc/zwp_primary_selection_offer_v1.rs +++ b/src/ifs/ipc/zwp_primary_selection_offer_v1.rs @@ -50,10 +50,6 @@ impl DynDataOffer for ZwpPrimarySelectionOfferV1 { ZwpPrimarySelectionOfferV1::send_offer(self, mime_type); } - fn destroy(&self) { - destroy_data_offer::(self); - } - fn cancel(&self) { cancel_offer::(self); } diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index 0e9c5ea8..837b145f 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -241,10 +241,6 @@ impl Global for WlOutputGlobal { fn version(&self) -> u32 { OUTPUT_VERSION } - - fn break_loops(&self) { - self.bindings.borrow_mut().clear(); - } } dedicated_add_global!(WlOutputGlobal, outputs); diff --git a/src/ifs/wl_seat.rs b/src/ifs/wl_seat.rs index 42591b8b..995cf94d 100644 --- a/src/ifs/wl_seat.rs +++ b/src/ifs/wl_seat.rs @@ -1203,12 +1203,6 @@ impl Global for WlSeatGlobal { fn version(&self) -> u32 { 9 } - - fn break_loops(&self) { - self.bindings.borrow_mut().clear(); - self.queue_link.take(); - self.tree_changed_handler.take(); - } } dedicated_add_global!(WlSeatGlobal, seats); diff --git a/src/ifs/wl_surface.rs b/src/ifs/wl_surface.rs index 4311bf81..be783528 100644 --- a/src/ifs/wl_surface.rs +++ b/src/ifs/wl_surface.rs @@ -339,10 +339,6 @@ trait SurfaceExt { } } - fn update_subsurface_parent_extents(&self) { - // nothing - } - fn subsurface_parent(&self) -> Option> { None } diff --git a/src/ifs/wp_drm_lease_device_v1.rs b/src/ifs/wp_drm_lease_device_v1.rs index c3bf68a5..3ad2ed5f 100644 --- a/src/ifs/wp_drm_lease_device_v1.rs +++ b/src/ifs/wp_drm_lease_device_v1.rs @@ -85,10 +85,6 @@ impl Global for WpDrmLeaseDeviceV1Global { 1 } - fn break_loops(&self) { - self.bindings.clear(); - } - fn required_caps(&self) -> ClientCaps { CAP_DRM_LEASE } diff --git a/src/macros.rs b/src/macros.rs index 9c79ee1e..680d771d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -467,33 +467,9 @@ macro_rules! fatal { macro_rules! stacked_node_impl { () => { - fn stacked_as_node(&self) -> &dyn Node { - self - } - fn stacked_into_node(self: Rc) -> Rc { self } - - fn stacked_into_dyn(self: Rc) -> Rc { - self - } - }; -} - -macro_rules! containing_node_impl { - () => { - fn cnode_as_node(&self) -> &dyn Node { - self - } - - fn cnode_into_node(self: Rc) -> Rc { - self - } - - fn cnode_into_dyn(self: Rc) -> Rc { - self - } }; } diff --git a/src/object.rs b/src/object.rs index ee19f454..eca34cd6 100644 --- a/src/object.rs +++ b/src/object.rs @@ -39,6 +39,7 @@ impl Display for ObjectId { pub trait ObjectBase { fn id(&self) -> ObjectId; fn version(&self) -> Version; + #[cfg_attr(not(feature = "it"), allow(dead_code))] fn into_any(self: Rc) -> Rc; fn handle_request( self: Rc, diff --git a/src/pipewire/pw_pod.rs b/src/pipewire/pw_pod.rs index 9f63a548..d2de0b5a 100644 --- a/src/pipewire/pw_pod.rs +++ b/src/pipewire/pw_pod.rs @@ -799,10 +799,6 @@ pub struct spa_meta_cursor { unsafe impl Pod for spa_meta_cursor {} -#[repr(C)] -#[derive(Copy, Clone, Debug)] -pub struct spa_meta_control {} - #[repr(C)] #[derive(Copy, Clone, Debug)] pub struct spa_meta_busy { diff --git a/src/tools/tool_client.rs b/src/tools/tool_client.rs index ce8e7ce2..91457104 100644 --- a/src/tools/tool_client.rs +++ b/src/tools/tool_client.rs @@ -345,6 +345,7 @@ pub trait Handle: RequestParser<'static> { R: 'static, H: for<'a> Fn(&R, Self::Generic<'a>) + 'static; + #[allow(dead_code)] fn handle2(tl: &Rc, id: impl Into, r: R, h: H) where R: 'static, diff --git a/src/tree.rs b/src/tree.rs index 33566120..394cb636 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -358,10 +358,6 @@ pub trait Node: 'static { None } - fn node_into_output(self: Rc) -> Option> { - None - } - fn node_into_surface(self: Rc) -> Option> { None } @@ -380,10 +376,6 @@ pub trait Node: 'static { false } - fn node_is_output(&self) -> bool { - false - } - fn node_is_float(&self) -> bool { false } diff --git a/src/tree/container.rs b/src/tree/container.rs index 7750eb34..650d5b0b 100644 --- a/src/tree/container.rs +++ b/src/tree/container.rs @@ -1342,8 +1342,6 @@ impl Node for ContainerNode { } impl ContainingNode for ContainerNode { - containing_node_impl!(); - fn cnode_replace_child(self: Rc, old: &dyn Node, new: Rc) { let node = match self.child_nodes.borrow_mut().remove(&old.node_id()) { Some(c) => c, diff --git a/src/tree/containing.rs b/src/tree/containing.rs index 94ac7f4c..220af820 100644 --- a/src/tree/containing.rs +++ b/src/tree/containing.rs @@ -4,10 +4,6 @@ use { }; pub trait ContainingNode: Node { - fn cnode_as_node(&self) -> &dyn Node; - fn cnode_into_node(self: Rc) -> Rc; - fn cnode_into_dyn(self: Rc) -> Rc; - fn cnode_replace_child(self: Rc, old: &dyn Node, new: Rc); fn cnode_remove_child(self: Rc, child: &dyn Node) { self.cnode_remove_child2(child, false); diff --git a/src/tree/float.rs b/src/tree/float.rs index b9da33dc..949ac892 100644 --- a/src/tree/float.rs +++ b/src/tree/float.rs @@ -586,8 +586,6 @@ impl Node for FloatNode { } impl ContainingNode for FloatNode { - containing_node_impl!(); - fn cnode_replace_child(self: Rc, _old: &dyn Node, new: Rc) { self.discard_child_properties(); self.child.set(Some(new.clone())); diff --git a/src/tree/output.rs b/src/tree/output.rs index c3de992a..2b71957d 100644 --- a/src/tree/output.rs +++ b/src/tree/output.rs @@ -912,14 +912,6 @@ impl Node for OutputNode { fn node_on_pointer_motion(self: Rc, seat: &Rc, x: Fixed, y: Fixed) { self.pointer_move(seat, x.round_down(), y.round_down()); } - - fn node_into_output(self: Rc) -> Option> { - Some(self.clone()) - } - - fn node_is_output(&self) -> bool { - true - } } pub fn calculate_logical_size( diff --git a/src/tree/stacked.rs b/src/tree/stacked.rs index f0f03e52..1a5d6cbc 100644 --- a/src/tree/stacked.rs +++ b/src/tree/stacked.rs @@ -1,9 +1,7 @@ use {crate::tree::Node, std::rc::Rc}; pub trait StackedNode: Node { - fn stacked_as_node(&self) -> &dyn Node; fn stacked_into_node(self: Rc) -> Rc; - fn stacked_into_dyn(self: Rc) -> Rc; fn stacked_prepare_set_visible(&self) { // nothing } diff --git a/src/tree/toplevel.rs b/src/tree/toplevel.rs index c7d00b97..7aefabe3 100644 --- a/src/tree/toplevel.rs +++ b/src/tree/toplevel.rs @@ -84,7 +84,11 @@ impl ToplevelNode for T { parent.node_child_title_changed(self, &title); } if let Some(data) = data.fullscrceen_data.borrow_mut().deref() { - *data.placeholder.tl_data().title.borrow_mut() = title.clone(); + data.placeholder + .tl_data() + .title + .borrow_mut() + .clone_from(&title); data.placeholder.tl_title_changed(); } } diff --git a/src/tree/workspace.rs b/src/tree/workspace.rs index 343a3845..b986c44c 100644 --- a/src/tree/workspace.rs +++ b/src/tree/workspace.rs @@ -291,8 +291,6 @@ impl Node for WorkspaceNode { } impl ContainingNode for WorkspaceNode { - containing_node_impl!(); - fn cnode_replace_child(self: Rc, old: &dyn Node, new: Rc) { if let Some(container) = self.container.get() { if container.node_id() == old.node_id() { diff --git a/src/utils/copyhashmap.rs b/src/utils/copyhashmap.rs index b56edbc2..a83140ff 100644 --- a/src/utils/copyhashmap.rs +++ b/src/utils/copyhashmap.rs @@ -41,26 +41,26 @@ impl CopyHashMap { unsafe { self.map.get().deref_mut().insert(k, v) } } - pub fn get(&self, k: &Q) -> Option + pub fn get(&self, k: &Q) -> Option where V: UnsafeCellCloneSafe, - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, K: Borrow, { unsafe { self.map.get().deref().get(k).cloned() } } - pub fn remove(&self, k: &Q) -> Option + pub fn remove(&self, k: &Q) -> Option where - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, K: Borrow, { unsafe { self.map.get().deref_mut().remove(k) } } - pub fn contains(&self, k: &Q) -> bool + pub fn contains(&self, k: &Q) -> bool where - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, K: Borrow, { unsafe { self.map.get().deref().contains_key(k) } diff --git a/src/utils/oserror.rs b/src/utils/oserror.rs index 3f6c73e0..aa7c8411 100644 --- a/src/utils/oserror.rs +++ b/src/utils/oserror.rs @@ -205,6 +205,7 @@ impl Display for OsError { } } +#[cfg_attr(not(feature = "it"), allow(dead_code))] pub trait OsErrorExt { type Container; diff --git a/src/utils/tri.rs b/src/utils/tri.rs index 1384c0ad..56285a97 100644 --- a/src/utils/tri.rs +++ b/src/utils/tri.rs @@ -10,6 +10,7 @@ pub trait Try: Sized { where F: FnOnce() -> Result<(), Self>; + #[allow(dead_code)] fn tria(f: F) -> Tria where F: Future>; diff --git a/src/utils/windows.rs b/src/utils/windows.rs index b4d51ddf..4128ef5c 100644 --- a/src/utils/windows.rs +++ b/src/utils/windows.rs @@ -1,11 +1,13 @@ use crate::utils::ptr_ext::PtrExt; +#[cfg_attr(not(feature = "it"), allow(dead_code))] pub trait WindowsExt { type Windows<'a, const N: usize>: Iterator where Self: 'a, T: 'a; + #[cfg_attr(not(feature = "rc_tracking"), allow(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]]; } diff --git a/toml-config/src/toml/toml_span.rs b/toml-config/src/toml/toml_span.rs index 8b338654..6d42424c 100644 --- a/toml-config/src/toml/toml_span.rs +++ b/toml-config/src/toml/toml_span.rs @@ -106,19 +106,3 @@ impl DespanExt for Option> { self.map(|v| v.value.into()) } } - -pub trait SpannedResultExt1: Sized { - type T; - type E; - - fn map_spanned U>(self, f: F) -> Result, Self::E>; -} - -impl SpannedResultExt1 for Result, E> { - type T = T; - type E = E; - - fn map_spanned U>(self, f: F) -> Result, Self::E> { - self.map(|v| v.map(f)) - } -}