Skip to content

Commit 21d5852

Browse files
committed
Use feature(generic_associated_types) as in stable
The feature(generic_associated_types) has been recently stabilized and does not need to be listed in the `#![feature(...)]` block. Also, move the `where` clauses on GAT impls to after the type assignment, taking advantage of a syntax change described here: rust-lang/rust#89122
1 parent 3dda461 commit 21d5852

File tree

11 files changed

+42
-61
lines changed

11 files changed

+42
-61
lines changed

apex-engine/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#![feature(generic_associated_types, type_alias_impl_trait)]
1+
#![feature(type_alias_impl_trait)]
22
mod engine;
33
pub use engine::{Engine, HEARTBEAT, REMOVE_EVENT, REMOVE_GAME};

apex-hardware/src/device.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,15 @@ impl<T: Device> AsyncDevice for T
121121
where
122122
T: 'static,
123123
{
124-
type ClearResult<'a>
124+
type ClearResult<'a> = impl Future<Output = Result<()>> + 'a
125125
where
126-
Self: 'a,
127-
= impl Future<Output = Result<()>> + 'a;
128-
type DrawResult<'a>
126+
Self: 'a;
127+
type DrawResult<'a> = impl Future<Output = Result<()>> + 'a
129128
where
130-
Self: 'a,
131-
= impl Future<Output = Result<()>> + 'a;
132-
type ShutdownResult<'a>
129+
Self: 'a;
130+
type ShutdownResult<'a> = impl Future<Output = Result<()>> + 'a
133131
where
134-
Self: 'a,
135-
= impl Future<Output = Result<()>> + 'a;
132+
Self: 'a;
136133

137134
#[allow(clippy::needless_lifetimes)]
138135
fn draw<'this>(&'this mut self, display: &'this FrameBuffer) -> Self::DrawResult<'this> {

apex-hardware/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_associated_types, type_alias_impl_trait)]
1+
#![feature(type_alias_impl_trait)]
22
mod device;
33
#[cfg(feature = "usb")]
44
mod usb;

apex-mpris2/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_associated_types, type_alias_impl_trait, async_iterator)]
1+
#![feature(type_alias_impl_trait, async_iterator)]
22
mod generated;
33
mod player;
44
pub use player::{Metadata, Player, MPRIS2};

apex-mpris2/src/player.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -195,22 +195,18 @@ impl<'a> Player<'a> {
195195
impl<'a> AsyncPlayer for Player<'a> {
196196
type Metadata = Metadata;
197197

198-
type MetadataFuture<'b>
198+
type MetadataFuture<'b> = impl Future<Output = Result<Self::Metadata>> + 'b
199199
where
200-
Self: 'b,
201-
= impl Future<Output = Result<Self::Metadata>> + 'b;
202-
type NameFuture<'b>
200+
Self: 'b;
201+
type NameFuture<'b> = impl Future<Output = String> + 'b
203202
where
204-
Self: 'b,
205-
= impl Future<Output = String> + 'b;
206-
type PlaybackStatusFuture<'b>
203+
Self: 'b;
204+
type PlaybackStatusFuture<'b> = impl Future<Output = Result<PlaybackStatus>> + 'b
207205
where
208-
Self: 'b,
209-
= impl Future<Output = Result<PlaybackStatus>> + 'b;
210-
type PositionFuture<'b>
206+
Self: 'b;
207+
type PositionFuture<'b> = impl Future<Output = Result<i64>> + 'b
211208
where
212-
Self: 'b,
213-
= impl Future<Output = Result<i64>> + 'b;
209+
Self: 'b;
214210

215211
#[allow(clippy::needless_lifetimes)]
216212
fn metadata<'this>(&'this self) -> Self::MetadataFuture<'this> {

apex-music/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_associated_types, type_alias_impl_trait)]
1+
#![feature(type_alias_impl_trait)]
22
mod player;
33
pub use player::{
44
AsyncMetadata, AsyncPlayer, Metadata, PlaybackStatus, Player, PlayerEvent, Progress,

apex-music/src/player.rs

+14-21
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,18 @@ pub trait AsyncPlayer {
7272
impl<T: Player + Sized> AsyncPlayer for T {
7373
type Metadata = <T as Player>::Metadata;
7474

75-
type MetadataFuture<'a>
75+
type MetadataFuture<'a> = impl Future<Output = Result<Self::Metadata>> + 'a
7676
where
77-
T: 'a,
78-
= impl Future<Output = Result<Self::Metadata>> + 'a;
79-
type NameFuture<'a>
77+
T: 'a;
78+
type NameFuture<'a> = impl Future<Output = String>
8079
where
81-
T: 'a,
82-
= impl Future<Output = String>;
83-
type PlaybackStatusFuture<'a>
80+
T: 'a;
81+
type PlaybackStatusFuture<'a> = impl Future<Output = Result<PlaybackStatus>>
8482
where
85-
T: 'a,
86-
= impl Future<Output = Result<PlaybackStatus>>;
87-
type PositionFuture<'a>
83+
T: 'a;
84+
type PositionFuture<'a> = impl Future<Output = Result<i64>>
8885
where
89-
T: 'a,
90-
= impl Future<Output = Result<i64>>;
86+
T: 'a;
9187

9288
#[allow(clippy::needless_lifetimes)]
9389
fn metadata<'this>(&'this self) -> Self::MetadataFuture<'this> {
@@ -137,18 +133,15 @@ pub trait AsyncMetadata {
137133

138134
/// Blanket implementation for non-async Metadata sources
139135
impl<T: Metadata + Sized> AsyncMetadata for T {
140-
type ArtistsFuture<'a>
136+
type ArtistsFuture<'a> = impl Future<Output = Result<String>> + 'a
141137
where
142-
T: 'a,
143-
= impl Future<Output = Result<String>> + 'a;
144-
type LengthFuture<'a>
138+
T: 'a;
139+
type LengthFuture<'a> = impl Future<Output = Result<i64>> + 'a
145140
where
146-
T: 'a,
147-
= impl Future<Output = Result<i64>> + 'a;
148-
type TitleFuture<'a>
141+
T: 'a;
142+
type TitleFuture<'a> = impl Future<Output = Result<String>> + 'a
149143
where
150-
T: 'a,
151-
= impl Future<Output = Result<String>> + 'a;
144+
T: 'a;
152145

153146
#[allow(clippy::needless_lifetimes)]
154147
fn title<'this>(&'this self) -> Self::TitleFuture<'this> {

apex-windows/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(generic_associated_types, type_alias_impl_trait,async_iterator)]
1+
#![feature(type_alias_impl_trait,async_iterator)]
22
mod music;
33
pub use music::Player;
44
pub use music::Metadata;

apex-windows/src/music.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,18 @@ impl Player {
9393
impl AsyncPlayer for Player {
9494
type Metadata = Metadata;
9595

96-
type MetadataFuture<'b>
96+
type MetadataFuture<'b> = impl Future<Output = Result<Self::Metadata>> + 'b
9797
where
98-
Self: 'b,
99-
= impl Future<Output = Result<Self::Metadata>> + 'b;
100-
type NameFuture<'b>
98+
Self: 'b;
99+
type NameFuture<'b> = impl Future<Output = String> + 'b
101100
where
102-
Self: 'b,
103-
= impl Future<Output = String> + 'b;
104-
type PlaybackStatusFuture<'b>
101+
Self: 'b;
102+
type PlaybackStatusFuture<'b> = impl Future<Output = Result<PlaybackStatus>> + 'b
105103
where
106-
Self: 'b,
107-
= impl Future<Output = Result<PlaybackStatus>> + 'b;
108-
type PositionFuture<'b>
104+
Self: 'b;
105+
type PositionFuture<'b> = impl Future<Output = Result<i64>> + 'b
109106
where
110-
Self: 'b,
111-
= impl Future<Output = Result<i64>> + 'b;
107+
Self: 'b;
112108
#[allow(clippy::needless_lifetimes)]
113109
fn metadata<'this>(&'this self) -> Self::MetadataFuture<'this> {
114110
async {

src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![allow(incomplete_features)]
22
#![feature(
3-
generic_associated_types,
43
type_alias_impl_trait,
54
try_blocks,
65
const_fn_floating_point_arithmetic,

src/render/text.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl StatefulScrollable {
9898
/// * `text`: the new text
9999
///
100100
/// returns: Result<bool, Error>
101-
///
101+
///
102102
/// # Examples
103103
///
104104
/// ```

0 commit comments

Comments
 (0)