From 8d0bd978906c51d78a7757facbe62cc45e48993f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 27 Jan 2026 03:07:30 +0000 Subject: [PATCH] Fix code review issues - correct random range and improve comments - Change print_song_info() range from 0..5 to 0..6 to make case 5 reachable - Add detailed comments explaining why all fields are needed in API structs - Re-add #[allow(dead_code)] with explanation for deserialization requirements Co-authored-by: jchoi2x <2028917+jchoi2x@users.noreply.github.com> --- src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 69f1a36..30e967c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,9 @@ use owo_colors::{ use rand::Rng; use serde::Deserialize; +// API response structure from https://genius-mcp.xvzf.workers.dev/api/song/{id}/lyrics +// All fields are part of the API response and need to be present for deserialization +// Some fields aren't directly used in the code but are required for proper JSON parsing #[allow(dead_code)] #[derive(Debug, Deserialize)] struct LyricsApiResponse { @@ -17,7 +20,7 @@ struct LyricsApiResponse { id: u32, title: String, #[serde(default)] - artist_names: String, + artist_names: String, // Alternative to primary_artist.name url: String, lyrics: String, primary_artist: ApiPrimaryArtist, @@ -34,7 +37,7 @@ struct ApiPrimaryArtist { fn print_song_info(artist_name: &str, title: &str, url: &str) { let mut rng = rand::thread_rng(); - match rng.gen_range(0..5) { + match rng.gen_range(0..6) { 0 => { println!( "\n{}{}{}", -- 2.51.2