Skip to content

Commit

Permalink
Use feature(generic_associated_types) as in stable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BigBigos committed Nov 23, 2022
1 parent 3dda461 commit 21d5852
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 61 deletions.
2 changes: 1 addition & 1 deletion apex-engine/src/lib.rs
@@ -1,3 +1,3 @@
#![feature(generic_associated_types, type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]
mod engine;
pub use engine::{Engine, HEARTBEAT, REMOVE_EVENT, REMOVE_GAME};
15 changes: 6 additions & 9 deletions apex-hardware/src/device.rs
Expand Up @@ -121,18 +121,15 @@ impl<T: Device> AsyncDevice for T
where
T: 'static,
{
type ClearResult<'a>
type ClearResult<'a> = impl Future<Output = Result<()>> + 'a
where
Self: 'a,
= impl Future<Output = Result<()>> + 'a;
type DrawResult<'a>
Self: 'a;
type DrawResult<'a> = impl Future<Output = Result<()>> + 'a
where
Self: 'a,
= impl Future<Output = Result<()>> + 'a;
type ShutdownResult<'a>
Self: 'a;
type ShutdownResult<'a> = impl Future<Output = Result<()>> + 'a
where
Self: 'a,
= impl Future<Output = Result<()>> + 'a;
Self: 'a;

#[allow(clippy::needless_lifetimes)]
fn draw<'this>(&'this mut self, display: &'this FrameBuffer) -> Self::DrawResult<'this> {
Expand Down
2 changes: 1 addition & 1 deletion apex-hardware/src/lib.rs
@@ -1,4 +1,4 @@
#![feature(generic_associated_types, type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]
mod device;
#[cfg(feature = "usb")]
mod usb;
Expand Down
2 changes: 1 addition & 1 deletion apex-mpris2/src/lib.rs
@@ -1,4 +1,4 @@
#![feature(generic_associated_types, type_alias_impl_trait, async_iterator)]
#![feature(type_alias_impl_trait, async_iterator)]
mod generated;
mod player;
pub use player::{Metadata, Player, MPRIS2};
20 changes: 8 additions & 12 deletions apex-mpris2/src/player.rs
Expand Up @@ -195,22 +195,18 @@ impl<'a> Player<'a> {
impl<'a> AsyncPlayer for Player<'a> {
type Metadata = Metadata;

type MetadataFuture<'b>
type MetadataFuture<'b> = impl Future<Output = Result<Self::Metadata>> + 'b
where
Self: 'b,
= impl Future<Output = Result<Self::Metadata>> + 'b;
type NameFuture<'b>
Self: 'b;
type NameFuture<'b> = impl Future<Output = String> + 'b
where
Self: 'b,
= impl Future<Output = String> + 'b;
type PlaybackStatusFuture<'b>
Self: 'b;
type PlaybackStatusFuture<'b> = impl Future<Output = Result<PlaybackStatus>> + 'b
where
Self: 'b,
= impl Future<Output = Result<PlaybackStatus>> + 'b;
type PositionFuture<'b>
Self: 'b;
type PositionFuture<'b> = impl Future<Output = Result<i64>> + 'b
where
Self: 'b,
= impl Future<Output = Result<i64>> + 'b;
Self: 'b;

#[allow(clippy::needless_lifetimes)]
fn metadata<'this>(&'this self) -> Self::MetadataFuture<'this> {
Expand Down
2 changes: 1 addition & 1 deletion apex-music/src/lib.rs
@@ -1,4 +1,4 @@
#![feature(generic_associated_types, type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]
mod player;
pub use player::{
AsyncMetadata, AsyncPlayer, Metadata, PlaybackStatus, Player, PlayerEvent, Progress,
Expand Down
35 changes: 14 additions & 21 deletions apex-music/src/player.rs
Expand Up @@ -72,22 +72,18 @@ pub trait AsyncPlayer {
impl<T: Player + Sized> AsyncPlayer for T {
type Metadata = <T as Player>::Metadata;

type MetadataFuture<'a>
type MetadataFuture<'a> = impl Future<Output = Result<Self::Metadata>> + 'a
where
T: 'a,
= impl Future<Output = Result<Self::Metadata>> + 'a;
type NameFuture<'a>
T: 'a;
type NameFuture<'a> = impl Future<Output = String>
where
T: 'a,
= impl Future<Output = String>;
type PlaybackStatusFuture<'a>
T: 'a;
type PlaybackStatusFuture<'a> = impl Future<Output = Result<PlaybackStatus>>
where
T: 'a,
= impl Future<Output = Result<PlaybackStatus>>;
type PositionFuture<'a>
T: 'a;
type PositionFuture<'a> = impl Future<Output = Result<i64>>
where
T: 'a,
= impl Future<Output = Result<i64>>;
T: 'a;

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

/// Blanket implementation for non-async Metadata sources
impl<T: Metadata + Sized> AsyncMetadata for T {
type ArtistsFuture<'a>
type ArtistsFuture<'a> = impl Future<Output = Result<String>> + 'a
where
T: 'a,
= impl Future<Output = Result<String>> + 'a;
type LengthFuture<'a>
T: 'a;
type LengthFuture<'a> = impl Future<Output = Result<i64>> + 'a
where
T: 'a,
= impl Future<Output = Result<i64>> + 'a;
type TitleFuture<'a>
T: 'a;
type TitleFuture<'a> = impl Future<Output = Result<String>> + 'a
where
T: 'a,
= impl Future<Output = Result<String>> + 'a;
T: 'a;

#[allow(clippy::needless_lifetimes)]
fn title<'this>(&'this self) -> Self::TitleFuture<'this> {
Expand Down
2 changes: 1 addition & 1 deletion apex-windows/src/lib.rs
@@ -1,4 +1,4 @@
#![feature(generic_associated_types, type_alias_impl_trait,async_iterator)]
#![feature(type_alias_impl_trait,async_iterator)]
mod music;
pub use music::Player;
pub use music::Metadata;
20 changes: 8 additions & 12 deletions apex-windows/src/music.rs
Expand Up @@ -93,22 +93,18 @@ impl Player {
impl AsyncPlayer for Player {
type Metadata = Metadata;

type MetadataFuture<'b>
type MetadataFuture<'b> = impl Future<Output = Result<Self::Metadata>> + 'b
where
Self: 'b,
= impl Future<Output = Result<Self::Metadata>> + 'b;
type NameFuture<'b>
Self: 'b;
type NameFuture<'b> = impl Future<Output = String> + 'b
where
Self: 'b,
= impl Future<Output = String> + 'b;
type PlaybackStatusFuture<'b>
Self: 'b;
type PlaybackStatusFuture<'b> = impl Future<Output = Result<PlaybackStatus>> + 'b
where
Self: 'b,
= impl Future<Output = Result<PlaybackStatus>> + 'b;
type PositionFuture<'b>
Self: 'b;
type PositionFuture<'b> = impl Future<Output = Result<i64>> + 'b
where
Self: 'b,
= impl Future<Output = Result<i64>> + 'b;
Self: 'b;
#[allow(clippy::needless_lifetimes)]
fn metadata<'this>(&'this self) -> Self::MetadataFuture<'this> {
async {
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
@@ -1,6 +1,5 @@
#![allow(incomplete_features)]
#![feature(
generic_associated_types,
type_alias_impl_trait,
try_blocks,
const_fn_floating_point_arithmetic,
Expand Down
2 changes: 1 addition & 1 deletion src/render/text.rs
Expand Up @@ -98,7 +98,7 @@ impl StatefulScrollable {
/// * `text`: the new text
///
/// returns: Result<bool, Error>
///
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit 21d5852

Please sign in to comment.