rust-lang/book

Inconsistent dash (-) and underscore (_) usages in Cargo package names

tatsuya6502 opened this issue · 1 comments

I found that some of the Cargo packages in this book have dashes (-) in their names while others are having underscores (_).

Chapter Cargo Package Name
1 hello_cargo
2 guessing_game
7 my-project
14 add-one
19 hello_macro, hello_macro_derive

I think dashes are generally preferable over underscores for Cargo package today, so we might want to use dashes for all these packages?

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

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

Thanks for the suggestion! There are enough crates that use either hyphen or underscore though that I think it's good to get people used to checking which a crate uses. Eventually, I hope that it shouldn't make a difference.