1
0
Fork 0
forked from wry/wry

Merge pull request #191 from mahkoh/jorth/new-fixes

Fix some issues with rust 1.78
This commit is contained in:
mahkoh 2024-05-02 20:16:55 +02:00 committed by GitHub
commit 4d33dbf32f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 29 additions and 155 deletions

View file

@ -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 {{"

View file

@ -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) {

View file

@ -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);
}
_ => {}
}

View file

@ -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);

View file

@ -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<GfxApiOpt> {
mem::take(&mut *self.ctx.gfx_ops.borrow_mut())
}

View file

@ -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<Extensions, VulkanError> {
unsafe {

View file

@ -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,

View file

@ -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()
}

View file

@ -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!(

View file

@ -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()
}

View file

@ -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>;

View file

@ -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);
}

View file

@ -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::<XClipboardIpc>(self),
IpcLocation::PrimarySelection => destroy_data_offer::<XPrimarySelectionIpc>(self),
}
}
fn cancel(&self) {
match self.location {
IpcLocation::Clipboard => cancel_offer::<XClipboardIpc>(self),

View file

@ -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::<WlrClipboardIpc>(self);
break_device_loops::<WlrPrimarySelectionIpc>(self);
self.seat.remove_wlr_device(self);
}
}

View file

@ -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),

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -339,10 +339,6 @@ trait SurfaceExt {
}
}
fn update_subsurface_parent_extents(&self) {
// nothing
}
fn subsurface_parent(&self) -> Option<Rc<WlSurface>> {
None
}

View file

@ -85,10 +85,6 @@ impl Global for WpDrmLeaseDeviceV1Global {
1
}
fn break_loops(&self) {
self.bindings.clear();
}
fn required_caps(&self) -> ClientCaps {
CAP_DRM_LEASE
}

View file

@ -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
}
};
}

View file

@ -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>,

View file

@ -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 {

View file

@ -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,

View file

@ -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
}
@ -380,10 +376,6 @@ pub trait Node: 'static {
false
}
fn node_is_output(&self) -> bool {
false
}
fn node_is_float(&self) -> bool {
false
}

View file

@ -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,

View file

@ -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);

View file

@ -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()));

View file

@ -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(

View file

@ -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
}

View file

@ -84,7 +84,11 @@ impl<T: ToplevelNodeBase> 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();
}
}

View file

@ -291,8 +291,6 @@ impl Node for WorkspaceNode {
}
impl ContainingNode for WorkspaceNode {
containing_node_impl!();
fn cnode_replace_child(self: Rc<Self>, old: &dyn Node, new: Rc<dyn ToplevelNode>) {
if let Some(container) = self.container.get() {
if container.node_id() == old.node_id() {

View file

@ -41,26 +41,26 @@ impl<K: Eq + Hash, V> CopyHashMap<K, V> {
unsafe { self.map.get().deref_mut().insert(k, v) }
}
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<V>
pub fn get<Q>(&self, k: &Q) -> Option<V>
where
V: UnsafeCellCloneSafe,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
K: Borrow<Q>,
{
unsafe { self.map.get().deref().get(k).cloned() }
}
pub fn remove<Q: ?Sized>(&self, k: &Q) -> Option<V>
pub fn remove<Q>(&self, k: &Q) -> Option<V>
where
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
K: Borrow<Q>,
{
unsafe { self.map.get().deref_mut().remove(k) }
}
pub fn contains<Q: ?Sized>(&self, k: &Q) -> bool
pub fn contains<Q>(&self, k: &Q) -> bool
where
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
K: Borrow<Q>,
{
unsafe { self.map.get().deref().contains_key(k) }

View file

@ -205,6 +205,7 @@ impl Display for OsError {
}
}
#[cfg_attr(not(feature = "it"), allow(dead_code))]
pub trait OsErrorExt {
type Container;

View file

@ -10,6 +10,7 @@ pub trait Try: Sized {
where
F: FnOnce() -> Result<(), Self>;
#[allow(dead_code)]
fn tria<F>(f: F) -> Tria<Self, F>
where
F: Future<Output = Result<(), Self>>;

View file

@ -1,11 +1,13 @@
use crate::utils::ptr_ext::PtrExt;
#[cfg_attr(not(feature = "it"), allow(dead_code))]
pub trait WindowsExt<T> {
type Windows<'a, const N: usize>: Iterator<Item = &'a [T; N]>
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]];
}

View file

@ -106,19 +106,3 @@ impl<T> DespanExt for Option<Spanned<T>> {
self.map(|v| v.value.into())
}
}
pub trait SpannedResultExt1: Sized {
type T;
type E;
fn map_spanned<U, F: FnOnce(Self::T) -> U>(self, f: F) -> Result<Spanned<U>, Self::E>;
}
impl<T, E> SpannedResultExt1 for Result<Spanned<T>, E> {
type T = T;
type E = E;
fn map_spanned<U, F: FnOnce(Self::T) -> U>(self, f: F) -> Result<Spanned<U>, Self::E> {
self.map(|v| v.map(f))
}
}