Description
This seeks to address two problems.
-
vs _
The Rust community tends to use -
and _
as word separators in package/crate names. However, the allowance of both characters, and the fact that -
is invalid in a crate name in Rust source, has created something of a messy situation. For some crates, users need to write -
in their Cargo.toml and _
in their Rust source (tokio-core
, rustc-serialize
, num-traits
). For others, _
is used in both places (lazy_static
, serde_derive
, symbolic_expressions
). This creates a point of confusion and imposes additional cognitive overhead.
Proposal: teach Cargo to treat these characters as equivalent when reading crate names from Cargo.toml, normalizing them to _
(matching their representation in Rust source).
- Crates.io considers them to be the same when uploading crates
- Rustc will always see crate names with hyphens converted to underscores
(So there are no clashing crate names)
cAsE senSITIvIty
What was that one package called? inflector
? Oh, no, it's Inflector
. But crates.io will recognize any of inflector
, Inflector
, or even inFLeCtOr
. And in Rust source, you're expected to write extern crate inflector
.
Proposal: internally lowercase crate names read from Cargo.toml and treat case variations as equivalent. Since Rust only allows ASCII crate names, there's no need to deal with any of the oddities of Unicode case normalization.