style: code style
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -54,7 +54,6 @@ fn main() -> std::io::Result<()> {
|
|||||||
|
|
||||||
parsers.push(Parser::new(String::from("//fix"), Box::from(|x : Vec<char>| x.last().unwrap() == &'\n')));
|
parsers.push(Parser::new(String::from("//fix"), Box::from(|x : Vec<char>| x.last().unwrap() == &'\n')));
|
||||||
|
|
||||||
|
|
||||||
//loop on every file within the current dir
|
//loop on every file within the current dir
|
||||||
for entry in match glob(&path) {
|
for entry in match glob(&path) {
|
||||||
Ok(entry) => entry,
|
Ok(entry) => entry,
|
||||||
@@ -84,8 +83,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
let mut path = String::from(dirs::home_dir().unwrap().to_str().unwrap());
|
let mut path = String::from(dirs::home_dir().unwrap().to_str().unwrap());
|
||||||
path.push_str("/.cargo/todo_config");
|
path.push_str("/.cargo/todo_config");
|
||||||
// println!("{}",path);
|
// println!("{}",path);
|
||||||
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>>
|
fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>> where P: AsRef<Path> {
|
||||||
where P: AsRef<Path>, {
|
|
||||||
let file = match File::open(&filename) {
|
let file = match File::open(&filename) {
|
||||||
Ok(line) => line,
|
Ok(line) => line,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
@@ -100,7 +98,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
Ok(io::BufReader::new(file).lines())
|
Ok(io::BufReader::new(file).lines())
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut regex = Vec::new();
|
let mut regex = vec![];
|
||||||
for line in read_lines(path).unwrap() {
|
for line in read_lines(path).unwrap() {
|
||||||
let line = line.unwrap();
|
let line = line.unwrap();
|
||||||
regex.push(line);
|
regex.push(line);
|
||||||
@@ -115,7 +113,9 @@ fn main() -> std::io::Result<()> {
|
|||||||
println!("Couldn't access files. Error {}", e);
|
println!("Couldn't access files. Error {}", e);
|
||||||
Err(e).unwrap()
|
Err(e).unwrap()
|
||||||
}
|
}
|
||||||
} {
|
}
|
||||||
|
|
||||||
|
{
|
||||||
let path = entry.unwrap();
|
let path = entry.unwrap();
|
||||||
let path = Path::new(&path).strip_prefix(env::current_dir().unwrap().to_str().unwrap()).unwrap();
|
let path = Path::new(&path).strip_prefix(env::current_dir().unwrap().to_str().unwrap()).unwrap();
|
||||||
// println!("{}", path.to_str().unwrap());
|
// println!("{}", path.to_str().unwrap());
|
||||||
|
|||||||
Reference in New Issue
Block a user