Skip to content

Commit

Permalink
Switch cargo new default to --bin
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Feb 12, 2018
1 parent 9e5721c commit 9cb10e6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/bin/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/bin/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/getting-started/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 2 additions & 4 deletions src/doc/src/guide/creating-a-new-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]
Expand Down

0 comments on commit 9cb10e6

Please sign in to comment.