]>
Commit | Line | Data |
---|---|---|
450edc1f XL |
1 | # `cargo new` defaults to a binary project |
2 | ||
3 | ![Minimum Rust version: 1.25](https://img.shields.io/badge/Minimum%20Rust%20Version-1.25-brightgreen.svg) | |
4 | ||
5 | `cargo new` will now default to generating a binary, rather than a library. | |
6 | We try to keep Cargo’s CLI quite stable, but this change is important, and is | |
7 | unlikely to cause breakage. | |
8 | ||
dc9dc135 | 9 | For some background, `cargo new` accepts two flags: `--lib`, for creating |
450edc1f XL |
10 | libraries, and `--bin`, for creating binaries, or executables. If you don’t |
11 | pass one of these flags, it used to default to `--lib`. At the time, we made | |
12 | this decision because each binary (often) depends on many libraries, and so | |
13 | we thought the library case would be more common. However, this is incorrect; | |
14 | each library is depended upon by many binaries. Furthermore, when getting | |
15 | started, what you often want is a program you can run and play around with. | |
16 | It’s not just new Rustaceans though; even very long-time community members | |
17 | have said that they find this default surprising. As such, we’ve changed it, | |
18 | and it now defaults to `--bin`. |