@@ -16,7 +16,7 @@ use std::path::Path;
16
16
/// main() helps to generate the submission template .rs
17
17
fn main ( ) {
18
18
println ! ( "Welcome to leetcode-rust system." ) ;
19
- let mut solved_ids = get_solved_ids ( ) ;
19
+ let mut initialized_ids = get_initialized_ids ( ) ;
20
20
loop {
21
21
println ! ( "Please enter a frontend problem id, or \" random\" to generate a random one, or \" solve $i\" to move problem to solution/" ) ;
22
22
let mut is_random = false ;
@@ -33,7 +33,7 @@ fn main() {
33
33
34
34
if random_pattern. is_match ( id_arg) {
35
35
println ! ( "You select random mode." ) ;
36
- id = generate_random_id ( & solved_ids ) ;
36
+ id = generate_random_id ( & initialized_ids ) ;
37
37
is_random = true ;
38
38
println ! ( "Generate random problem: {}" , & id) ;
39
39
} else if solving_pattern. is_match ( id_arg) {
@@ -52,7 +52,7 @@ fn main() {
52
52
id = id_arg
53
53
. parse :: < u32 > ( )
54
54
. unwrap_or_else ( |_| panic ! ( "not a number: {}" , id_arg) ) ;
55
- if solved_ids . contains ( & id) {
55
+ if initialized_ids . contains ( & id) {
56
56
println ! ( "The problem you chose has been initialized in problem/" ) ;
57
57
continue ;
58
58
}
@@ -68,7 +68,7 @@ fn main() {
68
68
let code = problem. code_definition . iter ( ) . find ( |& d| d. value == "rust" ) ;
69
69
if code. is_none ( ) {
70
70
println ! ( "Problem {} has no rust version." , & id) ;
71
- solved_ids . push ( problem. question_id ) ;
71
+ initialized_ids . push ( problem. question_id ) ;
72
72
continue ;
73
73
}
74
74
let code = code. unwrap ( ) ;
@@ -162,7 +162,7 @@ fn generate_random_id(except_ids: &[u32]) -> u32 {
162
162
}
163
163
}
164
164
165
- fn get_solved_ids ( ) -> Vec < u32 > {
165
+ fn get_initialized_ids ( ) -> Vec < u32 > {
166
166
let content = fs:: read_to_string ( "./src/problem/mod.rs" ) . unwrap ( ) ;
167
167
let id_pattern = Regex :: new ( r"p(\d{4})_" ) . unwrap ( ) ;
168
168
id_pattern
0 commit comments