From 3588436e53b1a382f7c93b6f6e6724cfa808d38c Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 13 Jan 2021 14:28:59 +0100 Subject: [PATCH] Run rustfmt --- src/client.rs | 32 +++++++++++++++++++++++--------- src/endpoint.rs | 8 ++++++-- src/error.rs | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/client.rs b/src/client.rs index 8fe4f8e..2ce7792 100644 --- a/src/client.rs +++ b/src/client.rs @@ -4,9 +4,9 @@ use serde::Serialize; use ureq::Agent; use crate::endpoint::Endpoint; -use crate::Error; use crate::models::request::*; use crate::models::response::*; +use crate::Error; const API_ROOT_URL: &str = "https://api.listenbrainz.org/1/"; @@ -108,7 +108,7 @@ impl Client { min_ts: Option, max_ts: Option, count: Option, - time_range: Option + time_range: Option, ) -> Result { let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::UserListens(user_name)); @@ -156,7 +156,7 @@ impl Client { &mut self, count: Option, offset: Option, - range: Option<&str> + range: Option<&str>, ) -> Result { let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::StatsSitewideArtists); @@ -181,8 +181,11 @@ impl Client { user_name: &str, range: Option<&str>, ) -> Result { - let endpoint = format!("{}{}", API_ROOT_URL, - Endpoint::StatsUserListeningActivity(user_name)); + let endpoint = format!( + "{}{}", + API_ROOT_URL, + Endpoint::StatsUserListeningActivity(user_name) + ); let mut request = self.agent.get(&endpoint); @@ -199,8 +202,11 @@ impl Client { user_name: &str, range: Option<&str>, ) -> Result { - let endpoint = format!("{}{}", API_ROOT_URL, - Endpoint::StatsUserDailyActivity(user_name)); + let endpoint = format!( + "{}{}", + API_ROOT_URL, + Endpoint::StatsUserDailyActivity(user_name) + ); let mut request = self.agent.get(&endpoint); @@ -219,7 +225,11 @@ impl Client { offset: Option, range: Option<&str>, ) -> Result { - let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::StatsUserRecordings(user_name)); + let endpoint = format!( + "{}{}", + API_ROOT_URL, + Endpoint::StatsUserRecordings(user_name) + ); let mut request = self.agent.get(&endpoint); @@ -243,7 +253,11 @@ impl Client { range: Option<&str>, force_recalculate: Option, ) -> Result { - let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::StatsUserArtistMap(user_name)); + let endpoint = format!( + "{}{}", + API_ROOT_URL, + Endpoint::StatsUserArtistMap(user_name) + ); let mut request = self.agent.get(&endpoint); diff --git a/src/endpoint.rs b/src/endpoint.rs index c5bd4a4..5b690d2 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -34,8 +34,12 @@ impl<'a> fmt::Display for Endpoint<'a> { Self::UserListens(user) => return write!(f, "user/{}/listens", user), Self::LatestImport => "latest-import", Self::StatsSitewideArtists => "stats/sitewide/artists", - Self::StatsUserListeningActivity(user) => return write!(f, "stats/user/{}/listening-activity", user), - Self::StatsUserDailyActivity(user) => return write!(f, "stats/user/{}/daily-activity", user), + Self::StatsUserListeningActivity(user) => { + return write!(f, "stats/user/{}/listening-activity", user) + } + Self::StatsUserDailyActivity(user) => { + return write!(f, "stats/user/{}/daily-activity", user) + } Self::StatsUserRecordings(user) => return write!(f, "stats/user/{}/recordings", user), Self::StatsUserArtistMap(user) => return write!(f, "stats/user/{}/artist-map", user), Self::StatsUserReleases(user) => return write!(f, "stats/user/{}/releases", user), diff --git a/src/error.rs b/src/error.rs index d47c103..5f1d4ee 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,7 +12,7 @@ pub enum Error { code: u16, /// A message describing the error. - error: String + error: String, }, /// The input data could not be converted into JSON.