Switch `cargo new` default to `--bin`
authorAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 12 Feb 2018 17:00:59 +0000 (20:00 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 12 Feb 2018 18:38:24 +0000 (21:38 +0300)
src/bin/init.rs
src/bin/new.rs
src/cargo/ops/cargo_new.rs
src/doc/src/getting-started/first-steps.md
src/doc/src/guide/creating-a-new-project.md

index 74ae608acc23506adcae99b14357bbcb60b9ced5..7d2a8593cdabea735d1e686fcd61330fb4adaa99 100644 (file)
@@ -32,8 +32,8 @@ Options:
                         control system (git, hg, pijul, or fossil) or do not
                         initialize any version control at all (none), overriding
                         a global configuration.
-    --bin               Use a binary (application) template
-    --lib               Use a library template [default]
+    --bin               Use a binary (application) template [default]
+    --lib               Use a library template
     --name NAME         Set the resulting package name
     -v, --verbose ...   Use verbose output (-vv very verbose/build.rs output)
     -q, --quiet         No output printed to stdout
index 6b51a6180bdce4d2b6fd359daf7a874b869657eb..e18dcf8c27b033fbbc7d55b209e7f622d6493384 100644 (file)
@@ -32,8 +32,8 @@ Options:
                         control system (git, hg, pijul, or fossil) or do not
                         initialize any version control at all (none), overriding
                         a global configuration.
-    --bin               Use a binary (application) template
-    --lib               Use a library template [default]
+    --bin               Use a binary (application) template [default]
+    --lib               Use a library template
     --name NAME         Set the resulting package name, defaults to the value of <path>
     -v, --verbose ...   Use verbose output (-vv very verbose/build.rs output)
     -q, --quiet         No output printed to stdout
index 3cba288be93f21fa8076661aab71db615e0277d9..aaaa69e2176c572d940d64b4c58fb4ac3e3666f2 100644 (file)
@@ -92,8 +92,8 @@ impl<'a> NewOptions<'a> {
             (true, true) => bail!("can't specify both lib and binary outputs"),
             (true, false) => NewProjectKind::Bin,
             (false, true) => NewProjectKind::Lib,
-            // default to lib
-            (false, false) => NewProjectKind::Lib,
+            // default to bin
+            (false, false) => NewProjectKind::Bin,
         };
 
         let opts = NewOptions { version_control, kind, path, name };
index 6b31d8d0c868cac385004578a27895063b76e43e..3a0bad356514a259be3b7c78787063fe5a96ab39 100644 (file)
@@ -7,7 +7,7 @@ $ cargo new hello_world --bin
 ```
 
 We’re passing `--bin` because we’re making a binary program: if we
-were making a library, we’d leave it off.
+were making a library, we’d pass `--lib`.
 
 Let’s check out what Cargo has generated for us:
 
index 3566e02a33758245feebd490d4d9f47db05879a0..98f2a65d754ac0644472f6fbae3c0c17e40ecbc4 100644 (file)
@@ -7,7 +7,7 @@ $ cargo new hello_world --bin
 ```
 
 We’re passing `--bin` because we’re making a binary program: if we
-were making a library, we’d leave it off. This also initializes a new `git`
+were making a library, we’d pass `--lib`. This also initializes a new `git`
 repository by default. If you don't want it to do that, pass `--vcs none`.
 
 Let’s check out what Cargo has generated for us:
@@ -23,9 +23,7 @@ $ tree .
 1 directory, 2 files
 ```
 
-If we had just used `cargo new hello_world` without the `--bin` flag, then
-we would have a `lib.rs` instead of a `main.rs`. For now, however, this is all
-we need to get started. First, let’s check out `Cargo.toml`:
+Let’s take a closer look at `Cargo.toml`:
 
 ```toml
 [package]