NOTE rewritten from earlier version.
Currently, if you type in a crate name like
proc_macro2 you will get an error, with a message suggesting the correct combination of
_ (in this case
proc-macro2). This is a paper-cut, as no packages are allowed on crates.io that are equivalent to
proc-macro2 w.r.t. swapping
_s. I’m going to say that two crates are equivalent if you can make one from another by swapping
This RFC proposes to
- When cargo finds a crate in
Cargo.tomlthat is equivalent to another crate, it uses that crate and emits a warning.
For implementation, I would expect that the name is fixed as part of writing
Cargo.lock, and that within cargo the name has already been resolved. Otherwise, you need custom impl of
== for crate names, which would be more work. The warning would also encourage users to fix their
- This is a paper-cut that is mildly annoying and inconvenient, with an easy fix.
- It needs implementing. Crate names in Cargo.lock may not match Cargo.toml
cargo-editinto cargo. We could still do this, but I think currently no cargo tools will rewrite your Cargo.toml file. This would change if these commands were added. I think some users will still prefer the choice of how to add their own dependencies, like with
npm add --save.
- Implement the equivalence between crate names throughout cargo.
cargo-editbe merged into cargo as well?
- Should we encourage one style of package name (either with