Search lyrics or song metadata from your terminal
genius genius-lyrics-search genius-lyrics cli rust

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>

+5 -2
+5 -2
src/main.rs
··· 10 10 use rand::Rng; 11 11 use serde::Deserialize; 12 12 13 + // API response structure from https://genius-mcp.xvzf.workers.dev/api/song/{id}/lyrics 14 + // All fields are part of the API response and need to be present for deserialization 15 + // Some fields aren't directly used in the code but are required for proper JSON parsing 13 16 #[allow(dead_code)] 14 17 #[derive(Debug, Deserialize)] 15 18 struct LyricsApiResponse { ··· 17 20 id: u32, 18 21 title: String, 19 22 #[serde(default)] 20 - artist_names: String, 23 + artist_names: String, // Alternative to primary_artist.name 21 24 url: String, 22 25 lyrics: String, 23 26 primary_artist: ApiPrimaryArtist, ··· 34 37 35 38 fn print_song_info(artist_name: &str, title: &str, url: &str) { 36 39 let mut rng = rand::thread_rng(); 37 - match rng.gen_range(0..5) { 40 + match rng.gen_range(0..6) { 38 41 0 => { 39 42 println!( 40 43 "\n{}{}{}",