1 unstable release

0.1.0 Aug 7, 2021

#218 in Compression

Download history 8/week @ 2022-06-08 12/week @ 2022-06-15 15/week @ 2022-06-22 14/week @ 2022-06-29 11/week @ 2022-07-06 16/week @ 2022-07-13 21/week @ 2022-07-20 13/week @ 2022-07-27 18/week @ 2022-08-03 22/week @ 2022-08-10 15/week @ 2022-08-17 12/week @ 2022-08-24 14/week @ 2022-08-31 20/week @ 2022-09-07 19/week @ 2022-09-14 13/week @ 2022-09-21

66 downloads per month
Used in 2 crates

MIT/Apache

16KB
263 lines

rustminify

CI codecov dependency status

A tool for minifying Rust code.

rustminify-cli (Binary)

Crates.io Crates.io

 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)

Crates.io Crates.io

 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

~220–630KB
~15K SLoC