0

How to parse a minus float in cargo? like

#[test]
fn test1() {
    let args: Vec<String> = env::args().collect();
    println!("{:?}", args);
}

and run it with

cargo test --release test1 -- -1.0 --nocapture --exact
cargo test --release test1 -- '-1.0' --nocapture --exact
cargo test --release test1 -- "-1.0" --nocapture --exact
cargo test --release test1 -- `-1.0` --nocapture --exact
/xxx/test_bin test1 -1.0 --nocapture

It says error: Unrecognized option: '1' with rustc 1.64.0-nightly (6dba4ed21 2022-07-09)

YNX
  • 511
  • 6
  • 17

0 Answers0