Skip to content

Commit

Permalink
Merge pull request #191 from mahkoh/jorth/new-fixes
Browse files Browse the repository at this point in the history
Fix some issues with rust 1.78
  • Loading branch information
mahkoh authored May 2, 2024
2 parents a20008d + 84f7f88 commit 4d33dbf
Show file tree
Hide file tree
Showing 37 changed files with 29 additions and 155 deletions.
4 changes: 4 additions & 0 deletions build/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ fn write_request_handler<W: Write>(
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 {{"
Expand Down
1 change: 1 addition & 0 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ linear_ids!(DrmDeviceIds, DrmDeviceId);

pub trait Backend {
fn run(self: Rc<Self>) -> SpawnedFuture<Result<(), Box<dyn Error>>>;
#[cfg_attr(not(feature = "it"), allow(dead_code))]
fn into_any(self: Rc<Self>) -> Rc<dyn Any>;

fn switch_to(&self, vtnr: u32) {
Expand Down
4 changes: 2 additions & 2 deletions src/backends/metal/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
_ => {}
}
Expand Down
2 changes: 0 additions & 2 deletions src/gfx_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ pub enum ResetStatus {
}

pub trait GfxFramebuffer: Debug {
fn as_any(&self) -> &dyn Any;

fn take_render_ops(&self) -> Vec<GfxApiOpt>;

fn physical_size(&self) -> (i32, i32);
Expand Down
5 changes: 0 additions & 5 deletions src/gfx_apis/gl/renderer/framebuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use {
theme::Color,
},
std::{
any::Any,
cell::Cell,
fmt::{Debug, Formatter},
mem,
Expand Down Expand Up @@ -100,10 +99,6 @@ impl Framebuffer {
}

impl GfxFramebuffer for Framebuffer {
fn as_any(&self) -> &dyn Any {
self
}

fn take_render_ops(&self) -> Vec<GfxApiOpt> {
mem::take(&mut *self.ctx.gfx_ops.borrow_mut())
}
Expand Down
12 changes: 1 addition & 11 deletions src/gfx_apis/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<Extensions, VulkanError> {
unsafe {
Expand Down
5 changes: 0 additions & 5 deletions src/gfx_apis/vulkan/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions src/gfx_apis/vulkan/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<GfxApiOpt> {
self.render_ops.take()
}
Expand Down
3 changes: 0 additions & 3 deletions src/gfx_apis/vulkan/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
1 change: 0 additions & 1 deletion src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
1 change: 0 additions & 1 deletion src/ifs/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<WlSeatGlobal>;

Expand Down
4 changes: 0 additions & 4 deletions src/ifs/ipc/wl_data_offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ impl DynDataOffer for WlDataOffer {
WlDataOffer::send_offer(self, mime_type);
}

fn destroy(&self) {
destroy_data_offer::<ClipboardIpc>(self);
}

fn cancel(&self) {
cancel_offer::<ClipboardIpc>(self);
}
Expand Down
9 changes: 1 addition & 8 deletions src/ifs/ipc/x_data_offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -50,13 +50,6 @@ impl DynDataOffer for XDataOffer {
})
}

fn destroy(&self) {
match self.location {
IpcLocation::Clipboard => destroy_data_offer::<XClipboardIpc>(self),
IpcLocation::PrimarySelection => destroy_data_offer::<XPrimarySelectionIpc>(self),
}
}

fn cancel(&self) {
match self.location {
IpcLocation::Clipboard => cancel_offer::<XClipboardIpc>(self),
Expand Down
4 changes: 3 additions & 1 deletion src/ifs/ipc/zwlr_data_control_device_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -282,6 +282,8 @@ object_base! {

impl Object for ZwlrDataControlDeviceV1 {
fn break_loops(&self) {
break_device_loops::<WlrClipboardIpc>(self);
break_device_loops::<WlrPrimarySelectionIpc>(self);
self.seat.remove_wlr_device(self);
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/ifs/ipc/zwlr_data_control_offer_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<WlrClipboardIpc>(self),
IpcLocation::PrimarySelection => destroy_data_offer::<WlrPrimarySelectionIpc>(self),
}
}

fn cancel(&self) {
match self.location {
IpcLocation::Clipboard => cancel_offer::<WlrClipboardIpc>(self),
Expand Down
4 changes: 0 additions & 4 deletions src/ifs/ipc/zwp_primary_selection_offer_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ impl DynDataOffer for ZwpPrimarySelectionOfferV1 {
ZwpPrimarySelectionOfferV1::send_offer(self, mime_type);
}

fn destroy(&self) {
destroy_data_offer::<PrimarySelectionIpc>(self);
}

fn cancel(&self) {
cancel_offer::<PrimarySelectionIpc>(self);
}
Expand Down
4 changes: 0 additions & 4 deletions src/ifs/wl_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions src/ifs/wl_seat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/ifs/wl_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@ trait SurfaceExt {
}
}

fn update_subsurface_parent_extents(&self) {
// nothing
}

fn subsurface_parent(&self) -> Option<Rc<WlSurface>> {
None
}
Expand Down
4 changes: 0 additions & 4 deletions src/ifs/wp_drm_lease_device_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ impl Global for WpDrmLeaseDeviceV1Global {
1
}

fn break_loops(&self) {
self.bindings.clear();
}

fn required_caps(&self) -> ClientCaps {
CAP_DRM_LEASE
}
Expand Down
24 changes: 0 additions & 24 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>) -> Rc<dyn Node> {
self
}

fn stacked_into_dyn(self: Rc<Self>) -> Rc<dyn StackedNode> {
self
}
};
}

macro_rules! containing_node_impl {
() => {
fn cnode_as_node(&self) -> &dyn Node {
self
}

fn cnode_into_node(self: Rc<Self>) -> Rc<dyn Node> {
self
}

fn cnode_into_dyn(self: Rc<Self>) -> Rc<dyn ContainingNode> {
self
}
};
}

Expand Down
1 change: 1 addition & 0 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>) -> Rc<dyn Any>;
fn handle_request(
self: Rc<Self>,
Expand Down
4 changes: 0 additions & 4 deletions src/pipewire/pw_pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/tools/tool_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<R, F, H>(tl: &Rc<ToolClient>, id: impl Into<ObjectId>, r: R, h: H)
where
R: 'static,
Expand Down
8 changes: 0 additions & 8 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,6 @@ pub trait Node: 'static {
None
}

fn node_into_output(self: Rc<Self>) -> Option<Rc<OutputNode>> {
None
}

fn node_into_surface(self: Rc<Self>) -> Option<Rc<WlSurface>> {
None
}
Expand All @@ -380,10 +376,6 @@ pub trait Node: 'static {
false
}

fn node_is_output(&self) -> bool {
false
}

fn node_is_float(&self) -> bool {
false
}
Expand Down
2 changes: 0 additions & 2 deletions src/tree/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1342,8 +1342,6 @@ impl Node for ContainerNode {
}

impl ContainingNode for ContainerNode {
containing_node_impl!();

fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>) {
let node = match self.child_nodes.borrow_mut().remove(&old.node_id()) {
Some(c) => c,
Expand Down
4 changes: 0 additions & 4 deletions src/tree/containing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ use {
};

pub trait ContainingNode: Node {
fn cnode_as_node(&self) -> &dyn Node;
fn cnode_into_node(self: Rc<Self>) -> Rc<dyn Node>;
fn cnode_into_dyn(self: Rc<Self>) -> Rc<dyn ContainingNode>;

fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>);
fn cnode_remove_child(self: Rc<Self>, child: &dyn Node) {
self.cnode_remove_child2(child, false);
Expand Down
2 changes: 0 additions & 2 deletions src/tree/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,6 @@ impl Node for FloatNode {
}

impl ContainingNode for FloatNode {
containing_node_impl!();

fn cnode_replace_child(self: Rc<Self>, _old: &dyn Node, new: Rc<dyn ToplevelNode>) {
self.discard_child_properties();
self.child.set(Some(new.clone()));
Expand Down
8 changes: 0 additions & 8 deletions src/tree/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,14 +912,6 @@ impl Node for OutputNode {
fn node_on_pointer_motion(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, x: Fixed, y: Fixed) {
self.pointer_move(seat, x.round_down(), y.round_down());
}

fn node_into_output(self: Rc<Self>) -> Option<Rc<OutputNode>> {
Some(self.clone())
}

fn node_is_output(&self) -> bool {
true
}
}

pub fn calculate_logical_size(
Expand Down
2 changes: 0 additions & 2 deletions src/tree/stacked.rs
Original file line number Diff line number Diff line change
@@ -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<Self>) -> Rc<dyn Node>;
fn stacked_into_dyn(self: Rc<Self>) -> Rc<dyn StackedNode>;
fn stacked_prepare_set_visible(&self) {
// nothing
}
Expand Down
Loading

0 comments on commit 4d33dbf

Please sign in to comment.