Skip to content

Commit

Permalink
*Actually* remove async-trait and use AFIT
Browse files Browse the repository at this point in the history
  • Loading branch information
catuhana committed Nov 29, 2023
1 parent cd6b5fe commit 2e9ecbd
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ edition = "2021"

[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.74"
clap = { version = "4.4.10", features = ["derive"] }
confique = { git = "https://github.com/tuhanayim/confique", rev = "2c85724", default-features = false, features = [
"toml",
Expand Down
3 changes: 0 additions & 3 deletions src/platforms/lastfm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub struct LastFM {
pub api_key: String,
}

#[async_trait::async_trait]
pub trait LastFMPlatform: Platform {
const USER_AGENT: &'static str = "reqwest/0.11 [lure]";
const API_URL: &'static str;
Expand All @@ -31,7 +30,6 @@ pub trait LastFMPlatform: Platform {
) -> anyhow::Result<()>;
}

#[async_trait::async_trait]
impl LastFMPlatform for LastFM {
const API_URL: &'static str = "https://ws.audioscrobbler.com/2.0";

Expand All @@ -53,7 +51,6 @@ impl LastFMPlatform for LastFM {
}
}

#[async_trait::async_trait]
impl Platform for LastFM {
type Platform = Self;

Expand Down
1 change: 0 additions & 1 deletion src/platforms/listenbrainz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ impl ListenBrainz {
}
}

#[async_trait::async_trait]
impl Platform for ListenBrainz {
type Platform = Self;

Expand Down
1 change: 0 additions & 1 deletion src/platforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub struct Status {
pub idle: Option<String>,
}

#[async_trait::async_trait]
pub trait Platform {
type Platform;

Expand Down
4 changes: 1 addition & 3 deletions src/rive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ use rive_models::{
user::{FieldsUser, UserStatus},
};

#[async_trait::async_trait]
pub trait ClientExt {
async fn ping(&self) -> anyhow::Result<(), anyhow::Error>;

Check failure on line 8 in src/rive.rs

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, stable)

functions in traits cannot be declared `async`

Check failure on line 8 in src/rive.rs

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, stable)

functions in traits cannot be declared `async`
async fn set_status(&self, status: Option<String>) -> ();
async fn set_status(&self, status: Option<String>);

Check failure on line 9 in src/rive.rs

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, stable)

functions in traits cannot be declared `async`

Check failure on line 9 in src/rive.rs

View workflow job for this annotation

GitHub Actions / Run CI (ubuntu-latest, stable)

functions in traits cannot be declared `async`
}

#[async_trait::async_trait]
impl ClientExt for Client {
async fn ping(&self) -> anyhow::Result<(), anyhow::Error> {
tracing::debug!("pinging Revolt API");
Expand Down

0 comments on commit 2e9ecbd

Please sign in to comment.