Skip to content

Commit

Permalink
Fix clippy lints on Rust 1.72
Browse files Browse the repository at this point in the history
Should fix CI build.

I'm not sure about the use of `Arc` in `MemoryRenderBuffer`. It seems
`MemoryRenderBufferInner` isn't `Send` because `Box<dyn Any>>` isn't.
`Send` can be added there if a `Send` bound is added on `TextureId`.
But then `GlesTexture` isn't `Send` so that presumably isn't desired in
general.
  • Loading branch information
ids1024 committed Aug 30, 2023
1 parent 04dea95 commit 6699361
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/backend/drm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
#[cfg(all(feature = "wayland_frontend", feature = "backend_gbm"))]
pub mod compositor;
pub(crate) mod device;
pub(self) mod error;
mod error;
#[cfg(feature = "backend_gbm")]
pub mod gbm;
pub mod node;

pub(self) mod surface;
mod surface;

use crate::utils::DevPath;
pub use device::{
Expand Down
2 changes: 2 additions & 0 deletions src/backend/drm/surface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ impl DrmSurface {
.cast::<u8>()
.offset(fmt_mod_blob.modifiers_offset as isize)
as *const _;
#[allow(clippy::unnecessary_cast)]
let formats_ptr = formats_ptr as *const u32;
#[allow(clippy::unnecessary_cast)]
let modifiers_ptr = modifiers_ptr as *const drm_ffi::drm_format_modifier;

for i in 0..fmt_mod_blob.count_modifiers {
Expand Down
1 change: 1 addition & 0 deletions src/backend/egl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ unsafe impl Send for EGLBufferReader {}
#[cfg(feature = "use_system_lib")]
impl EGLBufferReader {
fn new(display: Arc<EGLDisplayHandle>, wayland: *mut wl_display) -> Self {
#[allow(clippy::arc_with_non_send_sync)]
Self {
display,
wayland: Some(Arc::new(wayland)),
Expand Down
2 changes: 2 additions & 0 deletions src/backend/renderer/element/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ impl MemoryRenderBuffer {
opaque_regions: Option<Vec<Rectangle<i32, Buffer>>>,
) -> Self {
let inner = MemoryRenderBufferInner::new(format, size, scale, transform, opaque_regions);
#[allow(clippy::arc_with_non_send_sync)]
MemoryRenderBuffer {
id: Id::new(),
inner: Arc::new(Mutex::new(inner)),
Expand All @@ -408,6 +409,7 @@ impl MemoryRenderBuffer {
opaque_regions: Option<Vec<Rectangle<i32, Buffer>>>,
) -> Self {
let inner = MemoryRenderBufferInner::from_memory(mem, format, size, scale, transform, opaque_regions);
#[allow(clippy::arc_with_non_send_sync)]
MemoryRenderBuffer {
id: Id::new(),
inner: Arc::new(Mutex::new(inner)),
Expand Down
2 changes: 1 addition & 1 deletion src/backend/vulkan/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Drop for InstanceInner {
.debug_utils
.destroy_debug_utils_messenger(debug.debug_messenger, None);
}
Some(unsafe { Box::from_raw(debug.span_ptr as *mut tracing::Span) })
Some(unsafe { Box::from_raw(debug.span_ptr) })
} else {
None
};
Expand Down
1 change: 1 addition & 0 deletions src/backend/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ impl Instance {
info!("Created new instance");
info!("Enabled instance extensions: {:?}", inner.enabled_extensions);

#[allow(clippy::arc_with_non_send_sync)]
Ok(Instance(Arc::new(inner)))
}

Expand Down
5 changes: 1 addition & 4 deletions src/utils/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ impl<Kind> Time<Kind> {

impl<Kind> Clone for Time<Kind> {
fn clone(&self) -> Self {
Self {
tp: self.tp,
_kind: self._kind,
}
*self
}
}

Expand Down

0 comments on commit 6699361

Please sign in to comment.