use genemichaels for formatting

This commit is contained in:
Deadbeef 2023-05-26 19:56:45 +08:00
parent 4d234fc6a0
commit 9467c55770
31 changed files with 165 additions and 4969 deletions

View file

@ -79,7 +79,7 @@ fn wrap_func_body(func: &str) -> Result<String> {
}
};
Ok(prettyplease::unparse(&syn_file))
crate::formatting::format(syn_file)
}
impl RustFunction {

7
src/formatting.rs Normal file
View file

@ -0,0 +1,7 @@
use std::collections::HashMap;
use genemichaels::FormatConfig;
pub fn format(file: syn::File) -> anyhow::Result<String> {
Ok(genemichaels::format_ast(file, &FormatConfig::default(), HashMap::new())?.rendered)
}

View file

@ -9,6 +9,7 @@ use std::{
mod build;
mod dylib_flag;
mod formatting;
mod passes;
mod processor;

View file

@ -196,7 +196,7 @@ impl Minimizer {
match has_made_change {
ProcessState::Changed | ProcessState::FileInvalidated => {
let result = prettyplease::unparse(&krate);
let result = crate::formatting::format(krate)?;
change.write(&result)?;