diff --git a/src/main.rs b/src/main.rs index 959739f..f4f79ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use std::fs::OpenOptions; use std::env; use std::path::Path; use std::fs::File; -use std::io::{ self, BufRead }; +use std::io::{ self, Lines, BufRead, BufReader }; use std::collections::HashSet; use glob::glob; use colored::Colorize; @@ -33,7 +33,7 @@ fn main() -> std::io::Result<()> { .get_matches(); if let Some(_matches) = matches.subcommand_matches("legacy") { - let mut parsers : Vec = vec!(); + let mut parsers : Vec = vec![]; let mut path = String::from(env::current_dir().unwrap().to_str().unwrap()); path.push_str("/**/*.rs"); @@ -41,17 +41,17 @@ fn main() -> std::io::Result<()> { //we add a parser looking for the //todo keyword parsers.push(Parser::new(String::from("//todo"), Box::from(|x : Vec| x.last().unwrap() == &'\n'))); //we add a parser looking for the todo!() token - let _todo_macro_callback = Box::from(|mut text : String, line : usize, file : &str| { + let todo_macro_callback = Box::from(|mut text : String, line : usize, file : &str| { text.retain(|c| c != '\"'); println!("{} {} {} {} : {}",file,"TODO".green() ,"Line ".green(), line.to_string().green(), text.blue()); }); - parsers.push(Parser::new_callback(String::from("todo!("), Box::from(|x : Vec| x.last().unwrap() == &')'), _todo_macro_callback)); + parsers.push(Parser::new_callback(String::from("todo!("), Box::from(|x : Vec| x.last().unwrap() == &')'), todo_macro_callback)); //support for unimplemented - let _unimplemented_macro_callback = Box::from(|text : String, line : usize, file : &str| { - println!("{} {} {} {} : {}{}{} ",file,"TODO".green() ,"Line ".green(), line.to_string().green(), "unimplemented!(".blue(), text.magenta(), ")".blue()); + let unimplemented_macro_callback = Box::from(|text : String, line : usize, file : &str| { + println!("{} {} {} {} : {}{}{} ", file, "TODO".green(), "Line ".green(), line.to_string().green(), "unimplemented!(".blue(), text.magenta(), ")".blue()); }); - parsers.push(Parser::new_callback(String::from("unimplemented!("), Box::from(|x : Vec| x.last().unwrap() == &')'), _unimplemented_macro_callback)); + parsers.push(Parser::new_callback(String::from("unimplemented!("), Box::from(|x : Vec| x.last().unwrap() == &')'), unimplemented_macro_callback)); parsers.push(Parser::new(String::from("//fix"), Box::from(|x : Vec| x.last().unwrap() == &'\n'))); @@ -84,7 +84,7 @@ fn main() -> std::io::Result<()> { let mut path = String::from(dirs::home_dir().unwrap().to_str().unwrap()); path.push_str("/.cargo/todo_config"); // println!("{}",path); - fn read_lines

(filename: P) -> io::Result>> where P: AsRef { + fn read_lines

(filename: P) -> io::Result>> where P: AsRef { let file = match File::open(&filename) { Ok(line) => line, Err(_) => { @@ -96,7 +96,7 @@ fn main() -> std::io::Result<()> { return read_lines(filename); } }; - Ok(io::BufReader::new(file).lines()) + Ok(BufReader::new(file).lines()) } let mut regex = vec![];