mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-15 00:45:02 +01:00
wow
This commit is contained in:
parent
d9f3f347e9
commit
002bad34ae
5 changed files with 96 additions and 40 deletions
|
|
@ -8,7 +8,7 @@ use anyhow::{ensure, Context, Result};
|
|||
use crate::build::Build;
|
||||
|
||||
pub trait Processor {
|
||||
fn process_file(&mut self, krate: &mut syn::File) -> bool;
|
||||
fn process_file(&mut self, krate: &mut syn::File, checker: &mut ProcessChecker) -> bool;
|
||||
|
||||
fn name(&self) -> &'static str;
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ impl Minimizer {
|
|||
let mut krate = syn::parse_file(&before_string)
|
||||
.with_context(|| format!("parsing file {file_display}"))?;
|
||||
|
||||
let has_made_change = pass.process_file(&mut krate);
|
||||
let has_made_change = pass.process_file(&mut krate, &mut ProcessChecker {});
|
||||
|
||||
if has_made_change {
|
||||
let result = prettyplease::unparse(&krate);
|
||||
|
|
@ -95,3 +95,11 @@ impl Minimizer {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ProcessChecker {}
|
||||
|
||||
impl ProcessChecker {
|
||||
pub fn can_process(&mut self, _: &[String]) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue