Skip to content

Commit 695f53a

Browse files
committed
clarify var and fn name
1 parent 76edb8c commit 695f53a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::path::Path;
1616
/// main() helps to generate the submission template .rs
1717
fn main() {
1818
println!("Welcome to leetcode-rust system.");
19-
let mut solved_ids = get_solved_ids();
19+
let mut initialized_ids = get_initialized_ids();
2020
loop {
2121
println!("Please enter a frontend problem id, or \"random\" to generate a random one, or \"solve $i\" to move problem to solution/");
2222
let mut is_random = false;
@@ -33,7 +33,7 @@ fn main() {
3333

3434
if random_pattern.is_match(id_arg) {
3535
println!("You select random mode.");
36-
id = generate_random_id(&solved_ids);
36+
id = generate_random_id(&initialized_ids);
3737
is_random = true;
3838
println!("Generate random problem: {}", &id);
3939
} else if solving_pattern.is_match(id_arg) {
@@ -52,7 +52,7 @@ fn main() {
5252
id = id_arg
5353
.parse::<u32>()
5454
.unwrap_or_else(|_| panic!("not a number: {}", id_arg));
55-
if solved_ids.contains(&id) {
55+
if initialized_ids.contains(&id) {
5656
println!("The problem you chose has been initialized in problem/");
5757
continue;
5858
}
@@ -68,7 +68,7 @@ fn main() {
6868
let code = problem.code_definition.iter().find(|&d| d.value == "rust");
6969
if code.is_none() {
7070
println!("Problem {} has no rust version.", &id);
71-
solved_ids.push(problem.question_id);
71+
initialized_ids.push(problem.question_id);
7272
continue;
7373
}
7474
let code = code.unwrap();
@@ -162,7 +162,7 @@ fn generate_random_id(except_ids: &[u32]) -> u32 {
162162
}
163163
}
164164

165-
fn get_solved_ids() -> Vec<u32> {
165+
fn get_initialized_ids() -> Vec<u32> {
166166
let content = fs::read_to_string("./src/problem/mod.rs").unwrap();
167167
let id_pattern = Regex::new(r"p(\d{4})_").unwrap();
168168
id_pattern

0 commit comments

Comments
 (0)