refactor(build): format using cargo fmt
This commit is contained in:
parent
07380713b6
commit
acf26d6e90
1 changed files with 20 additions and 16 deletions
32
build.rs
32
build.rs
|
|
@ -1,16 +1,8 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{
|
||||
self,
|
||||
DirEntry,
|
||||
ReadDir,
|
||||
write,
|
||||
},
|
||||
fs::{self, DirEntry, ReadDir, write},
|
||||
io,
|
||||
path::{
|
||||
Path,
|
||||
PathBuf
|
||||
}
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
const COMMAND_DIR: &str = "./src/commands/";
|
||||
|
|
@ -35,7 +27,10 @@ fn read_dir(dir: &Path) -> Vec<String> {
|
|||
for entry in fs::read_dir(dir).unwrap() {
|
||||
let entry: DirEntry = entry.unwrap();
|
||||
let pb: PathBuf = entry.path();
|
||||
if pb.is_file() && pb.to_string_lossy().ends_with(".rs") && !pb.to_string_lossy().ends_with("mod.rs") {
|
||||
if pb.is_file()
|
||||
&& pb.to_string_lossy().ends_with(".rs")
|
||||
&& !pb.to_string_lossy().ends_with("mod.rs")
|
||||
{
|
||||
dir_content.push(clear_name(pb.to_string_lossy().to_mut(), len));
|
||||
}
|
||||
}
|
||||
|
|
@ -72,10 +67,16 @@ fn commands() -> io::Result<()> {
|
|||
submodules = String::from(MOD_PREFIX) + command + &String::from(";\n");
|
||||
println!("\t'{}'", command);
|
||||
}
|
||||
write(String::from(COMMAND_DIR) + subdir + &String::from("/mod.rs"), submodules)?;
|
||||
write(
|
||||
String::from(COMMAND_DIR) + subdir + &String::from("/mod.rs"),
|
||||
submodules,
|
||||
)?;
|
||||
modules = modules + &String::from(MOD_PREFIX) + subdir + &String::from(";\n");
|
||||
}
|
||||
write(String::from(COMMAND_DIR) + &String::from("/mod.rs"), modules)?;
|
||||
write(
|
||||
String::from(COMMAND_DIR) + &String::from("/mod.rs"),
|
||||
modules,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -91,7 +92,10 @@ fn events() -> io::Result<()> {
|
|||
submodules = String::from(MOD_PREFIX) + event + &String::from(";\n");
|
||||
println!("\t'{}'", event);
|
||||
}
|
||||
write(String::from(EVENT_DIR) + subdir + &String::from("/mod.rs"), submodules)?;
|
||||
write(
|
||||
String::from(EVENT_DIR) + subdir + &String::from("/mod.rs"),
|
||||
submodules,
|
||||
)?;
|
||||
modules = modules + &String::from(MOD_PREFIX) + subdir + &String::from(";\n");
|
||||
}
|
||||
write(String::from(EVENT_DIR) + &String::from("/mod.rs"), modules)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue