1 unstable release
0.1.0 | Aug 10, 2021 |
---|
#12 in #minification
21KB
330 lines
rustminify
A tool for minifying Rust code.
rustminify-cli
(Binary)
❯ cargo install rustminify-cli
❯ rustminify --remove-docs <<EOF
//! crate-level doc
fn main() {
println!("{}", module::f());
}
mod module {
//! module-level doc
/// doc for an item
pub(crate) fn f() -> i32 {
1 + 1
}
}
EOF
fn main(){println!("{}",module::f());}mod module{pub(crate)fn f()->i32{1+1}}
rustminify
(Library)
❯ cargo add rustminify
use syn::parse_quote;
assert_eq!(
r#"fn main(){println!("{}",module::f());}mod module{pub(crate)fn f()->i32{1+1}}"#,
rustminify::minify_file(&rustminify::remove_docs(parse_quote! {
//! crate-level doc
fn main() {
println!("{}", module::f());
}
mod module {
//! module-level doc
/// doc for an item
pub(crate) fn f() -> i32 {
1 + 1
}
}
})),
);
License
Dual-licensed under MIT or Apache-2.0.
Dependencies
~3MB
~52K SLoC