mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 08:25:01 +01:00
Minor reaper opti: don't do rustfix with no suggestions
This commit is contained in:
parent
2f885257e6
commit
0b7e1c2a82
1 changed files with 8 additions and 0 deletions
|
|
@ -75,9 +75,17 @@ impl Minimizer {
|
||||||
.copied()
|
.copied()
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
if desired_suggestions.is_empty() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let result =
|
let result =
|
||||||
rustfix::apply_suggestions(change.before_content().0, &desired_suggestions)?;
|
rustfix::apply_suggestions(change.before_content().0, &desired_suggestions)?;
|
||||||
|
anyhow::ensure!(
|
||||||
|
result != change.before_content().0,
|
||||||
|
"Suggestions 'applied' but no changes made??"
|
||||||
|
);
|
||||||
|
|
||||||
let result = syn::parse_file(&result).context("parsing file after rustfix")?;
|
let result = syn::parse_file(&result).context("parsing file after rustfix")?;
|
||||||
change.write(result)?;
|
change.write(result)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue