style: code style
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -36,14 +36,10 @@ fn main() -> std::io::Result<()> {
|
||||
main_legacy()
|
||||
} else {
|
||||
let mut tokens : Vec<Token> = vec![];
|
||||
|
||||
let mut togo_config_path = String::from(dirs::home_dir().unwrap().to_str().unwrap());
|
||||
togo_config_path.push_str("/.cargo/todo_config");
|
||||
|
||||
let mut regex = vec![];
|
||||
for line in read_lines(togo_config_path).unwrap() {
|
||||
let line = line.unwrap();
|
||||
if !line.is_empty() { regex.push(line) };
|
||||
}
|
||||
let regex = read_lines_to_vec(&togo_config_path);
|
||||
|
||||
let mut all_rs_path = String::from(env::current_dir().unwrap().to_str().unwrap());
|
||||
all_rs_path.push_str("/**/*.rs");
|
||||
@@ -129,6 +125,15 @@ fn main() -> std::io::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_lines_to_vec(file_name: &str) -> Vec<String> {
|
||||
let mut regex = vec![];
|
||||
for line in read_lines(file_name).unwrap() {
|
||||
let line = line.unwrap();
|
||||
if !line.is_empty() { regex.push(line) };
|
||||
}
|
||||
return regex;
|
||||
}
|
||||
|
||||
fn read_lines<P>(filename: P) -> io::Result<Lines<BufReader<File>>> where P: AsRef<Path> {
|
||||
let file = match File::open(&filename) {
|
||||
Ok(line) => line,
|
||||
|
||||
Reference in New Issue
Block a user