mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
use genemichaels for formatting
This commit is contained in:
parent
4d234fc6a0
commit
9467c55770
31 changed files with 165 additions and 4969 deletions
|
|
@ -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
7
src/formatting.rs
Normal 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)
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ use std::{
|
|||
|
||||
mod build;
|
||||
mod dylib_flag;
|
||||
mod formatting;
|
||||
mod passes;
|
||||
mod processor;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue