cargo new defaults to a binary project
cargo new
will now default to generating a binary, rather than a library.We try to keep Cargo’s CLI quite stable, but this change is important, and isunlikely to cause breakage.
For some background, cargo new
accepts two flags: —lib
, for creatinglibraries, and —bin
, for creating binaries, or executables. If you don’tpass one of these flags, it used to default to —lib
. At the time, we madethis decision because each binary (often) depends on many libraries, and sowe thought the library case would be more common. However, this is incorrect;each library is depended upon by many binaries. Furthermore, when gettingstarted, what you often want is a program you can run and play around with.It’s not just new Rustaceans though; even very long-time community membershave said that they find this default surprising. As such, we’ve changed it,and it now defaults to —bin
.