From a175d49385bf68e248ca33145be812f44b49311c Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 26 Jul 2020 17:35:40 +0800 Subject: [PATCH] style: code style --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index d6bc0c5..2e6fc70 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,7 +35,7 @@ fn main() -> std::io::Result<()> { if let Some(_) = matches.subcommand_matches("legacy") { main_legacy() } else { - let mut tokens : Vec = Vec::new(); + let mut tokens : Vec = 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() } @@ -61,11 +62,9 @@ fn main() -> std::io::Result<()> { let file_path = path.to_str().unwrap(); let verbose_count = matches.occurrences_of("verbose"); - let verbosity = if verbose_count == 0 || verbose_count == 2 {2} else {1}; + let verbosity = if verbose_count == 0 || verbose_count == 2 { 2 } else { 1 }; match regex_parser(file_path, ®ex, 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() }