style: code style

This commit is contained in:
2020-07-26 17:35:40 +08:00
parent 341bd1793e
commit a175d49385

View File

@@ -35,7 +35,7 @@ fn main() -> std::io::Result<()> {
if let Some(_) = matches.subcommand_matches("legacy") {
main_legacy()
} else {
let mut tokens : Vec<Token> = Vec::new();
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");
@@ -49,7 +49,8 @@ fn main() -> std::io::Result<()> {
all_rs_path.push_str("/**/*.rs");
for entry in match glob(&all_rs_path) {
Ok(entry) => entry, Err(e) => {
Ok(entry) => entry,
Err(e) => {
println!("Couldn't access files. Error {}", e);
Err(e).unwrap()
}
@@ -63,9 +64,7 @@ fn main() -> std::io::Result<()> {
let verbose_count = matches.occurrences_of("verbose");
let verbosity = if verbose_count == 0 || verbose_count == 2 { 2 } else { 1 };
match regex_parser(file_path, &regex, verbosity) {
Ok(mut t) => {
tokens.append(&mut t);
},
Ok(mut t) => tokens.append(&mut t),
Err(e) => eprintln!{"{}", e},
}
}
@@ -170,7 +169,8 @@ fn main_legacy() -> std::io::Result<()> {
//loop on every file within the current dir
for entry in match glob(&path) {
Ok(entry) => entry, Err(e) => {
Ok(entry) => entry,
Err(e) => {
println!("Couldn't access files. Error {}", e);
Err(e).unwrap()
}