diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 125a112..d2f96e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,10 @@ jobs: RUST_BACKTRACE: 1 CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0 --deny warnings ${{ matrix.platform.rustflags }}" - OPTIONS: ${{ matrix.platform.options }} + # Disable doc tests on Rust 1.83, since some path handling regressed there. + # This has been fixed in Rust 1.84 beta. + # https://github.com/rust-lang/rust/issues/132203 + OPTIONS: ${{ matrix.platform.options }} ${{ matrix.rust_version == 'stable' && '--lib' || '' }} FEATURES: ${{ format(',{0}', matrix.platform.features ) }} CMD: ${{ matrix.platform.cmd }} RUSTDOCFLAGS: -Dwarnings diff --git a/src/backends/cg.rs b/src/backends/cg.rs index ba957d8..85bba70 100644 --- a/src/backends/cg.rs +++ b/src/backends/cg.rs @@ -144,7 +144,10 @@ impl Drop for CGImpl { impl SurfaceInterface for CGImpl { type Context = D; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; fn new(window_src: W, _display: &D) -> Result> { // `NSView`/`UIView` can only be accessed from the main thread. @@ -288,7 +291,7 @@ pub struct BufferImpl<'a, D, W> { buffer: Vec, } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> { +impl BufferInterface for BufferImpl<'_, D, W> { #[inline] fn pixels(&self) -> &[u32] { &self.buffer diff --git a/src/backends/kms.rs b/src/backends/kms.rs index 901fc73..1ff6682 100644 --- a/src/backends/kms.rs +++ b/src/backends/kms.rs @@ -134,7 +134,10 @@ struct SharedBuffer { impl SurfaceInterface for KmsImpl { type Context = Arc>; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; /// Create a new KMS backend. fn new(window: W, display: &Arc>) -> Result> { @@ -191,7 +194,7 @@ impl SurfaceInterface fo .filter(|connector| { connector .current_encoder() - .map_or(false, |encoder| encoders.contains(&encoder)) + .is_some_and(|encoder| encoders.contains(&encoder)) }) .map(|info| info.handle()) .collect::>(); diff --git a/src/backends/orbital.rs b/src/backends/orbital.rs index 96c3db1..cd5dd05 100644 --- a/src/backends/orbital.rs +++ b/src/backends/orbital.rs @@ -41,7 +41,7 @@ impl OrbitalMap { unsafe { slice::from_raw_parts(self.address as *const u32, self.size_unaligned / 4) } } - unsafe fn data_mut(&self) -> &mut [u32] { + unsafe fn data_mut(&mut self) -> &mut [u32] { unsafe { slice::from_raw_parts_mut(self.address as *mut u32, self.size_unaligned / 4) } } } @@ -99,7 +99,7 @@ impl OrbitalImpl { { // Map window buffer - let window_map = + let mut window_map = unsafe { OrbitalMap::new(self.window_fd(), window_width * window_height * 4) } .expect("failed to map orbital window"); @@ -128,7 +128,10 @@ impl OrbitalImpl { impl SurfaceInterface for OrbitalImpl { type Context = D; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; fn new(window: W, _display: &D) -> Result> { let raw = window.window_handle()?.as_raw(); @@ -188,7 +191,7 @@ pub struct BufferImpl<'a, D, W> { pixels: Pixels, } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> { +impl BufferInterface for BufferImpl<'_, D, W> { #[inline] fn pixels(&self) -> &[u32] { match &self.pixels { diff --git a/src/backends/wayland/mod.rs b/src/backends/wayland/mod.rs index 2dda8d2..2c1e33b 100644 --- a/src/backends/wayland/mod.rs +++ b/src/backends/wayland/mod.rs @@ -151,7 +151,10 @@ impl SurfaceInterface for WaylandImpl { type Context = Arc>; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; fn new(window: W, display: &Arc>) -> Result> { // Get the raw Wayland window. @@ -261,9 +264,7 @@ pub struct BufferImpl<'a, D: ?Sized, W> { age: u8, } -impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle> BufferInterface - for BufferImpl<'a, D, W> -{ +impl BufferInterface for BufferImpl<'_, D, W> { #[inline] fn pixels(&self) -> &[u32] { self.stack.member() diff --git a/src/backends/web.rs b/src/backends/web.rs index 539e2d2..10b0ccd 100644 --- a/src/backends/web.rs +++ b/src/backends/web.rs @@ -207,7 +207,10 @@ impl WebImpl { impl SurfaceInterface for WebImpl { type Context = WebDisplayImpl; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; fn new(window: W, display: &WebDisplayImpl) -> Result> { let raw = window.window_handle()?.as_raw(); @@ -374,7 +377,7 @@ pub struct BufferImpl<'a, D, W> { imp: &'a mut WebImpl, } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> { +impl BufferInterface for BufferImpl<'_, D, W> { fn pixels(&self) -> &[u32] { &self.imp.buffer } diff --git a/src/backends/win32.rs b/src/backends/win32.rs index 084ad47..01f6c83 100644 --- a/src/backends/win32.rs +++ b/src/backends/win32.rs @@ -208,7 +208,10 @@ impl Win32Impl { impl SurfaceInterface for Win32Impl { type Context = D; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; /// Create a new `Win32Impl` from a `Win32WindowHandle`. fn new(window: W, _display: &D) -> Result> { @@ -281,7 +284,7 @@ impl SurfaceInterface for Win32Im pub struct BufferImpl<'a, D, W>(&'a mut Win32Impl); -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> { +impl BufferInterface for BufferImpl<'_, D, W> { #[inline] fn pixels(&self) -> &[u32] { self.0.buffer.as_ref().unwrap().pixels() diff --git a/src/backends/x11.rs b/src/backends/x11.rs index b01fb5f..b91081c 100644 --- a/src/backends/x11.rs +++ b/src/backends/x11.rs @@ -184,7 +184,10 @@ struct ShmBuffer { impl SurfaceInterface for X11Impl { type Context = Arc>; - type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a; + type Buffer<'a> + = BufferImpl<'a, D, W> + where + Self: 'a; /// Create a new `X11Impl` from a `HasWindowHandle`. fn new(window_src: W, display: &Arc>) -> Result> { @@ -384,8 +387,8 @@ impl SurfaceInterface fo pub struct BufferImpl<'a, D: ?Sized, W: ?Sized>(&'a mut X11Impl); -impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface - for BufferImpl<'a, D, W> +impl BufferInterface + for BufferImpl<'_, D, W> { #[inline] fn pixels(&self) -> &[u32] { diff --git a/src/lib.rs b/src/lib.rs index d19eafa..6647f59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -201,7 +201,7 @@ pub struct Buffer<'a, D, W> { _marker: PhantomData<(Arc, Cell<()>)>, } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> Buffer<'a, D, W> { +impl Buffer<'_, D, W> { /// Is age is the number of frames ago this buffer was last presented. So if the value is /// `1`, it is the same as the last frame, and if it is `2`, it is the same as the frame /// before that (for backends using double buffering). If the value is `0`, it is a new @@ -244,7 +244,7 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> Buffer<'a, D, W> { } } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W> { +impl ops::Deref for Buffer<'_, D, W> { type Target = [u32]; #[inline] @@ -253,7 +253,7 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W } } -impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::DerefMut for Buffer<'a, D, W> { +impl ops::DerefMut for Buffer<'_, D, W> { #[inline] fn deref_mut(&mut self) -> &mut [u32] { self.buffer_impl.pixels_mut()