Is it good practice to call crates "hello-world", "hello_world" or does it not matter?


#1

I’ve seen both ways, e.g. https://crates.io/crates/handlebars-markdown-helper or https://crates.io/crates/elastic_types. I know I was confused the first time that a crate is called like handlebars-markdown-helper, but it is used like extern crate handlebars_markdown_helper. (However I was only confused the first time. It’s not a problem for me now.)


#2

The - to _ thing didn’t always exist, so you’ll see a lot of earlier projects use _. The convention is generally to use -.


#3

Thank you for your feedback. I’ll point this out in my tutorial :slight_smile:


#4

Based on @steveklabnik’s comment I filed these two tickets to encourage hyphens. Cargo should allow dependencies to be specified using hyphens where the crate name contains underscores, and crates.io should display hyphens instead of underscores in all crate names in the UI.