Add a split-use pass.

It transforms "use std::io::{Read, Write}" into
"use std::io::Read; use std::io::Write"

Which later allows to remove just precisely the statements
we do not need, and leave rest be.

The test from the last commit does not pass, but that
is seemingly to do with the test harness setup, since it
works fine locally.
This commit is contained in:
moxian 2025-03-30 18:32:52 -07:00
parent 963a1faf69
commit 1f6cec7d7b
3 changed files with 142 additions and 1 deletions

View file

@ -142,6 +142,7 @@ pub fn minimize(options: Options, stop: Arc<AtomicBool>) -> Result<()> {
minimizer.run_passes([
passes::EverybodyLoops::default().boxed(),
passes::SplitUse::default().boxed(),
passes::FieldDeleter::default().boxed(),
passes::Privatize::default().boxed(),
])?;