bnjbvr / cargo-machete

Remove unused Rust dependencies with this one weird trick!
MIT License
722 stars 29 forks source link

[bug] missing field `version` - should not report #101

Closed 1oglop1 closed 7 months ago

1oglop1 commented 7 months ago

Hi I have a Cargo.toml file without version and machete is failing with

  |
1 | [package]
  | ^^^^^^^^^
missing field `version`

However, the version field is optional and has been for some time already. https://doc.rust-lang.org/cargo/reference/manifest.html#the-version-field

bnjbvr commented 7 months ago

Thanks for opening an issue, it might be one of the dependencies used for parsing that's responsible of that. Would you be interested in solving this with a pull request?

1oglop1 commented 7 months ago

I am not really a Rust magician, but it looks like you have pointed in the right direction:

https://gitlab.com/lib.rs/cargo_toml/-/blob/main/src/cargo_toml.rs?ref_type=heads#L1540-1545

I will try to open an issue there and see if anything comes out of it.

ref: https://gitlab.com/lib.rs/cargo_toml/-/issues/31

kornelski commented 7 months ago

cargo_toml supports optional version, but you're using outdated cargo_toml.

dspicher commented 7 months ago

@bnjbvr would you consider making a release to give access this fix? Would be great!

bnjbvr commented 7 months ago

@dspicher yes, doing this now in #108

dspicher commented 7 months ago

Thanks!