qryxip / cargo-equip

A Cargo subcommand to bundle your code into one `.rs` file for competitive programming
Apache License 2.0
76 stars 10 forks source link

Does not minify or remove tests and comments, regardless of command line parameters. #203

Open bcmpinc opened 10 months ago

bcmpinc commented 10 months ago

I tried using cargo-equip but no matter what I do it does not remove tests or comments.

I created a small test project, cargo-equip-bug.zip. When I run cargo equip --bin cargo-equip-bug --minify --remove docs the output I get is:

     Running `/home/bauke/.cargo/bin/rustup run nightly cargo udeps --output json -p cargo-equip-bug --bin cargo-equip-bug`
    Checking cargo-equip-bug v0.1.0 (/tmp/cargo-equip-bug)
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
info: Loading depinfo from "/tmp/cargo-equip-bug/target/debug/deps/cargo_equip_bug-fff717856e616173.d"
    Bundling the code
    Checking cargo-equip-check-output-v9rub87eoq2lw19m v0.0.0 (/tmp/cargo-equip-check-output-v9rub87eoq2lw19m)
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
#[allow(dead_code)]
pub mod a {
    pub struct A;

    #[cfg(test)]
    mod tests {
        #[test]
        fn it_works() {
            assert_eq!(2 + 2, 4);
        }
    }
}

// Comment
fn main() {
    println!("Hello, world!");
}

I would expect the output to not contain tests and comments.

Version info:

> rustup +nightly --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.0-nightly (7d9bce327 2023-09-16)`
> cargo equip --version
cargo-equip 0.20.2-alpha.1

I've tried with cargo-equip versions 0.15 to 0.20.1 as well, but get the same results.