Skip to content

Commit fa3a918

Browse files
madsmtmMarijnS95
andauthored
Fix CI after Rust 1.83 (#246)
* Reformat on Rust 1.83 * Disable doc tests on Rust 1.83 * Fix mutability error in Orbital backend * Appease Clippy Co-authored-by: Marijn Suijten <[email protected]>
1 parent 6d65b5b commit fa3a918

File tree

9 files changed

+45
-23
lines changed

9 files changed

+45
-23
lines changed

.github/workflows/ci.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ jobs:
6464
RUST_BACKTRACE: 1
6565
CARGO_INCREMENTAL: 0
6666
RUSTFLAGS: "-C debuginfo=0 --deny warnings ${{ matrix.platform.rustflags }}"
67-
OPTIONS: ${{ matrix.platform.options }}
67+
# Disable doc tests on Rust 1.83, since some path handling regressed there.
68+
# This has been fixed in Rust 1.84 beta.
69+
# https://github.com/rust-lang/rust/issues/132203
70+
OPTIONS: ${{ matrix.platform.options }} ${{ matrix.rust_version == 'stable' && '--lib' || '' }}
6871
FEATURES: ${{ format(',{0}', matrix.platform.features ) }}
6972
CMD: ${{ matrix.platform.cmd }}
7073
RUSTDOCFLAGS: -Dwarnings

src/backends/cg.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ impl<D, W> Drop for CGImpl<D, W> {
144144

145145
impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for CGImpl<D, W> {
146146
type Context = D;
147-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
147+
type Buffer<'a>
148+
= BufferImpl<'a, D, W>
149+
where
150+
Self: 'a;
148151

149152
fn new(window_src: W, _display: &D) -> Result<Self, InitError<W>> {
150153
// `NSView`/`UIView` can only be accessed from the main thread.
@@ -288,7 +291,7 @@ pub struct BufferImpl<'a, D, W> {
288291
buffer: Vec<u32>,
289292
}
290293

291-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
294+
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
292295
#[inline]
293296
fn pixels(&self) -> &[u32] {
294297
&self.buffer

src/backends/kms.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ struct SharedBuffer {
134134

135135
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> for KmsImpl<D, W> {
136136
type Context = Arc<KmsDisplayImpl<D>>;
137-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
137+
type Buffer<'a>
138+
= BufferImpl<'a, D, W>
139+
where
140+
Self: 'a;
138141

139142
/// Create a new KMS backend.
140143
fn new(window: W, display: &Arc<KmsDisplayImpl<D>>) -> Result<Self, InitError<W>> {
@@ -191,7 +194,7 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
191194
.filter(|connector| {
192195
connector
193196
.current_encoder()
194-
.map_or(false, |encoder| encoders.contains(&encoder))
197+
.is_some_and(|encoder| encoders.contains(&encoder))
195198
})
196199
.map(|info| info.handle())
197200
.collect::<Vec<_>>();

src/backends/orbital.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl OrbitalMap {
4141
unsafe { slice::from_raw_parts(self.address as *const u32, self.size_unaligned / 4) }
4242
}
4343

44-
unsafe fn data_mut(&self) -> &mut [u32] {
44+
unsafe fn data_mut(&mut self) -> &mut [u32] {
4545
unsafe { slice::from_raw_parts_mut(self.address as *mut u32, self.size_unaligned / 4) }
4646
}
4747
}
@@ -99,7 +99,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {
9999

100100
{
101101
// Map window buffer
102-
let window_map =
102+
let mut window_map =
103103
unsafe { OrbitalMap::new(self.window_fd(), window_width * window_height * 4) }
104104
.expect("failed to map orbital window");
105105

@@ -128,7 +128,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> OrbitalImpl<D, W> {
128128

129129
impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for OrbitalImpl<D, W> {
130130
type Context = D;
131-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
131+
type Buffer<'a>
132+
= BufferImpl<'a, D, W>
133+
where
134+
Self: 'a;
132135

133136
fn new(window: W, _display: &D) -> Result<Self, InitError<W>> {
134137
let raw = window.window_handle()?.as_raw();
@@ -188,7 +191,7 @@ pub struct BufferImpl<'a, D, W> {
188191
pixels: Pixels,
189192
}
190193

191-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
194+
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
192195
#[inline]
193196
fn pixels(&self) -> &[u32] {
194197
match &self.pixels {

src/backends/wayland/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W>
151151
for WaylandImpl<D, W>
152152
{
153153
type Context = Arc<WaylandDisplayImpl<D>>;
154-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
154+
type Buffer<'a>
155+
= BufferImpl<'a, D, W>
156+
where
157+
Self: 'a;
155158

156159
fn new(window: W, display: &Arc<WaylandDisplayImpl<D>>) -> Result<Self, InitError<W>> {
157160
// Get the raw Wayland window.
@@ -261,9 +264,7 @@ pub struct BufferImpl<'a, D: ?Sized, W> {
261264
age: u8,
262265
}
263266

264-
impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle> BufferInterface
265-
for BufferImpl<'a, D, W>
266-
{
267+
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
267268
#[inline]
268269
fn pixels(&self) -> &[u32] {
269270
self.stack.member()

src/backends/web.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> WebImpl<D, W> {
207207

208208
impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for WebImpl<D, W> {
209209
type Context = WebDisplayImpl<D>;
210-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
210+
type Buffer<'a>
211+
= BufferImpl<'a, D, W>
212+
where
213+
Self: 'a;
211214

212215
fn new(window: W, display: &WebDisplayImpl<D>) -> Result<Self, InitError<W>> {
213216
let raw = window.window_handle()?.as_raw();
@@ -374,7 +377,7 @@ pub struct BufferImpl<'a, D, W> {
374377
imp: &'a mut WebImpl<D, W>,
375378
}
376379

377-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
380+
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
378381
fn pixels(&self) -> &[u32] {
379382
&self.imp.buffer
380383
}

src/backends/win32.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> Win32Impl<D, W> {
208208

209209
impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for Win32Impl<D, W> {
210210
type Context = D;
211-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
211+
type Buffer<'a>
212+
= BufferImpl<'a, D, W>
213+
where
214+
Self: 'a;
212215

213216
/// Create a new `Win32Impl` from a `Win32WindowHandle`.
214217
fn new(window: W, _display: &D) -> Result<Self, crate::error::InitError<W>> {
@@ -281,7 +284,7 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> SurfaceInterface<D, W> for Win32Im
281284

282285
pub struct BufferImpl<'a, D, W>(&'a mut Win32Impl<D, W>);
283286

284-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'a, D, W> {
287+
impl<D: HasDisplayHandle, W: HasWindowHandle> BufferInterface for BufferImpl<'_, D, W> {
285288
#[inline]
286289
fn pixels(&self) -> &[u32] {
287290
self.0.buffer.as_ref().unwrap().pixels()

src/backends/x11.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ struct ShmBuffer {
184184

185185
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> for X11Impl<D, W> {
186186
type Context = Arc<X11DisplayImpl<D>>;
187-
type Buffer<'a> = BufferImpl<'a, D, W> where Self: 'a;
187+
type Buffer<'a>
188+
= BufferImpl<'a, D, W>
189+
where
190+
Self: 'a;
188191

189192
/// Create a new `X11Impl` from a `HasWindowHandle`.
190193
fn new(window_src: W, display: &Arc<X11DisplayImpl<D>>) -> Result<Self, InitError<W>> {
@@ -384,8 +387,8 @@ impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle> SurfaceInterface<D, W> fo
384387

385388
pub struct BufferImpl<'a, D: ?Sized, W: ?Sized>(&'a mut X11Impl<D, W>);
386389

387-
impl<'a, D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface
388-
for BufferImpl<'a, D, W>
390+
impl<D: HasDisplayHandle + ?Sized, W: HasWindowHandle + ?Sized> BufferInterface
391+
for BufferImpl<'_, D, W>
389392
{
390393
#[inline]
391394
fn pixels(&self) -> &[u32] {

src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub struct Buffer<'a, D, W> {
201201
_marker: PhantomData<(Arc<D>, Cell<()>)>,
202202
}
203203

204-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> Buffer<'a, D, W> {
204+
impl<D: HasDisplayHandle, W: HasWindowHandle> Buffer<'_, D, W> {
205205
/// Is age is the number of frames ago this buffer was last presented. So if the value is
206206
/// `1`, it is the same as the last frame, and if it is `2`, it is the same as the frame
207207
/// 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> {
244244
}
245245
}
246246

247-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W> {
247+
impl<D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'_, D, W> {
248248
type Target = [u32];
249249

250250
#[inline]
@@ -253,7 +253,7 @@ impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::Deref for Buffer<'a, D, W
253253
}
254254
}
255255

256-
impl<'a, D: HasDisplayHandle, W: HasWindowHandle> ops::DerefMut for Buffer<'a, D, W> {
256+
impl<D: HasDisplayHandle, W: HasWindowHandle> ops::DerefMut for Buffer<'_, D, W> {
257257
#[inline]
258258
fn deref_mut(&mut self) -> &mut [u32] {
259259
self.buffer_impl.pixels_mut()

0 commit comments

Comments
 (0)