Minor nits
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m58s
Cargo CI / Lint (pull_request) Successful in 1m5s

This commit is contained in:
Wojciech Kozlowski 2024-08-28 18:17:54 +02:00
parent 97e8941e90
commit 10b5b5ebfe
2 changed files with 5 additions and 4 deletions

View File

@ -22,7 +22,7 @@ pub struct MbidError(String);
impl fmt::Display for MbidError { impl fmt::Display for MbidError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0) write!(f, "failed to parse a MBID: {}", self.0)
} }
} }

View File

@ -20,15 +20,16 @@ impl<Http: IMusicBrainzHttp> MusicBrainzClient<Http> {
) -> Result<LookupArtistResponse, Error> { ) -> Result<LookupArtistResponse, Error> {
let mut include: Vec<String> = vec![]; let mut include: Vec<String> = vec![];
let mbid: String = request.mbid.uuid().as_hyphenated().to_string();
if request.release_groups { if request.release_groups {
include.push(String::from("release-groups")); include.push(String::from("release-groups"));
} }
let include: String = let include: String =
form_urlencoded::byte_serialize(include.join("+").as_bytes()).collect(); form_urlencoded::byte_serialize(include.join("+").as_bytes()).collect();
let url = format!("{MB_BASE_URL}/artist/{mbid}?inc={include}"); let url = format!(
"{MB_BASE_URL}/artist/{mbid}?inc={include}",
mbid = request.mbid.uuid().as_hyphenated()
);
let response: DeserializeLookupArtistResponse = self.http.get(&url)?; let response: DeserializeLookupArtistResponse = self.http.get(&url)?;
Ok(response.into()) Ok(response.into())