Run rustfmt

This commit is contained in:
Koen Bolhuis 2021-01-13 14:28:59 +01:00
parent 9581ce45cb
commit 3588436e53
3 changed files with 30 additions and 12 deletions

View File

@ -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<i64>,
max_ts: Option<i64>,
count: Option<u32>,
time_range: Option<u64>
time_range: Option<u64>,
) -> Result<UserListensResponse, Error> {
let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::UserListens(user_name));
@ -156,7 +156,7 @@ impl Client {
&mut self,
count: Option<u64>,
offset: Option<u64>,
range: Option<&str>
range: Option<&str>,
) -> Result<StatsSitewideArtistsResponse, Error> {
let endpoint = format!("{}{}", API_ROOT_URL, Endpoint::StatsSitewideArtists);
@ -181,8 +181,11 @@ impl Client {
user_name: &str,
range: Option<&str>,
) -> Result<StatsUserListeningActivityResponse, Error> {
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<StatsUserDailyActivityResponse, Error> {
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<u64>,
range: Option<&str>,
) -> Result<StatsUserRecordingsResponse, Error> {
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<bool>,
) -> Result<StatsUserArtistMapResponse, Error> {
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);

View File

@ -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),

View File

@ -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.