refactor: apply clippy rules
This commit is contained in:
parent
d205d722aa
commit
8f7d11226f
9 changed files with 153 additions and 245 deletions
|
|
@ -72,7 +72,7 @@ fn write_source_code(base_path: &Path, snc: SourceNodeContainer) -> Result<()> {
|
|||
let path = base_path.join(snc.name);
|
||||
match snc.inner {
|
||||
SourceNode::File(code) => {
|
||||
println!("writing file {:?}", path);
|
||||
println!("Writing file {:?}.", path);
|
||||
std::fs::write(path, code)?;
|
||||
}
|
||||
SourceNode::Directory(dir) => {
|
||||
|
|
@ -125,7 +125,10 @@ pub fn main() -> Result<()> {
|
|||
}
|
||||
eprintln!("Found models in project, parsing models");
|
||||
let models = parse_models::parse_models_from_module(&models_mod_path)?;
|
||||
dbg!(&models);
|
||||
eprintln!(
|
||||
"Found and parsed a grand total of {} sqlxgentools compatible models.",
|
||||
models.len()
|
||||
);
|
||||
|
||||
match args.nested {
|
||||
GeneratorArgsSubCommands::GenerateRepositories(opts) => {
|
||||
|
|
@ -137,7 +140,6 @@ pub fn main() -> Result<()> {
|
|||
return Err(anyhow!("Could not resolve repositories modules."));
|
||||
}
|
||||
let snc = generators::repositories::generate_repositories_source_files(&models)?;
|
||||
dbg!(&snc);
|
||||
write_source_code(&repositories_mod_path, snc)?;
|
||||
}
|
||||
GeneratorArgsSubCommands::GenerateMigration(opts) => {
|
||||
|
|
@ -145,8 +147,8 @@ pub fn main() -> Result<()> {
|
|||
let sql_code = generators::migrations::generate_create_table_sql(&models)?;
|
||||
if let Some(out_location) = opts.output {
|
||||
let output_path = Path::new(&out_location);
|
||||
let write_res = std::fs::write(output_path, sql_code);
|
||||
eprintln!("{:?}", write_res);
|
||||
let _write_res = std::fs::write(output_path, sql_code);
|
||||
// TODO: check if write result is an error and return error message.
|
||||
} else {
|
||||
println!("{}", sql_code);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue