Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the cargo TOML parser to allow dashes in `lib.name`. Cargo currently refuses explicit library names if they contain a dash. However, if no library name is specified, the package-name will be used, which itself can contain dashes. This leads to packages with `lib.name` containing dashes, if their package-name contains dashes. Drop this requirement and allow explicit `lib.name` configurations to contain dashes. The current ecosystem clearly allows `lib.name` to contain dashes, given that `cargo metadata` already reports such names for any package with a dash. It looks like an oversight that any explicit configuration is not allowed to include dashes. All consumers of `lib.name` already use `Target.crate_name()` rather than `Target.name()` if a sanitized name is required. Therefore, they already replace dashes with underscores. Last but not least, the current documentation is simply wrong in stating that `lib.name` defaults to the package-name with dashes replaced by underscores. Cargo never replaces dashes for `lib.name`, and `cargo metadata` and friends already happily show `lib.name` with dashes. Cargo merely replaces dashes with underscores to retrieve the crate-name of a target, which is then used as stem for library artifacts.
- Loading branch information