From 7b8a4e636027c30a36f46609c74c09e39a2340e4 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Fri, 2 Aug 2024 13:58:11 -0400 Subject: [PATCH] defined variable names more clearly --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5607a8d..ee52313 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,12 +6,12 @@ use std::io::BufReader; fn main() { let file = File::open("team_names.json").expect("Unable to open JSON"); let reader = BufReader::new(file); - let v: Value = serde_json::from_reader(reader).expect("Unable to parse JSON"); + let team_names_json: Value = serde_json::from_reader(reader).expect("Unable to parse JSON"); - let team_names = v["team_names"].as_array().unwrap(); + let team_names_list = team_names_json["team_names"].as_array().unwrap(); let mut rng = rand::thread_rng(); - if let Some(chosen_name) = team_names.choose(&mut rng) { + if let Some(chosen_name) = team_names_list.choose(&mut rng) { println!("Randomly chosen team name: {}", chosen_name); } else { println!("No team names available");