Skip to content

Commit 3e3a9b4

Browse files
committed
Rollup merge of rust-lang#27397 - Dangthrimble:master, r=steveklabnik
Clarifications for those new to Rust and Cargo: * It's a good idea to get rid of the original `main.exe` in project root * Slight clarification on the use of `main.rs` vs `lib.rs` * Clarify that the TOML file needs to be in project root
2 parents f971f86 + c54df0e commit 3e3a9b4

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

src/doc/trpl/guessing-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ use std::io;
9898

9999
We’ll need to take user input, and then print the result as output. As such, we
100100
need the `io` library from the standard library. Rust only imports a few things
101-
into every program, [the ‘prelude’][prelude]. If it’s not in the prelude,
102-
you’ll have to `use` it directly.
101+
by default into every program, [the ‘prelude’][prelude]. If it’s not in the
102+
prelude, you’ll have to `use` it directly.
103103

104104
[prelude]: ../std/prelude/index.html
105105

src/doc/trpl/hello-cargo.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ so it is assumed that Rust projects will use Cargo from the beginning.
88
[cratesio]: http://doc.crates.io
99

1010
Cargo manages three things: building your code, downloading the dependencies
11-
your code needs, and building those dependencies. At first, your
12-
program doesn’t have any dependencies, so we’ll only be using the first part of
13-
its functionality. Eventually, we’ll add more. Since we started off by using
14-
Cargo, it'll be easy to add later.
11+
your code needs, and building those dependencies. At first, your program doesn’t
12+
have any dependencies, so we’ll only be using the first part of its
13+
functionality. Eventually, we’ll add more. Since we started off by using Cargo,
14+
it'll be easy to add later.
1515

16-
If you installed Rust via the official installers you will also have Cargo. If
17-
you installed Rust some other way, you may want to [check the Cargo
16+
If we installed Rust via the official installers we will also have Cargo. If we
17+
installed Rust some other way, we may want to [check the Cargo
1818
README][cargoreadme] for specific instructions about installing it.
1919

2020
[cargoreadme]: https://github.com/rust-lang/cargo#installing-cargo-from-nightlies
@@ -23,20 +23,21 @@ README][cargoreadme] for specific instructions about installing it.
2323

2424
Let’s convert Hello World to Cargo.
2525

26-
To Cargo-ify our project, we need to do two things: Make a `Cargo.toml`
27-
configuration file, and put our source file in the right place. Let's
28-
do that part first:
26+
To Cargo-ify our project, we need to do three things: Make a `Cargo.toml`
27+
configuration file, put our source file in the right place, and get rid of the
28+
old executable (`main.exe` on Windows, `main` everywhere else). Let's do that part first:
2929

3030
```bash
3131
$ mkdir src
3232
$ mv main.rs src/main.rs
33+
$ rm main # or main.exe on Windows
3334
```
3435

35-
Note that since we're creating an executable, we used `main.rs`. If we
36-
want to make a library instead, we should use `lib.rs`. This convention is required
37-
for Cargo to successfully compile our projects, but it can be overridden if we wish.
38-
Custom file locations for the entry point can be specified
39-
with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
36+
Note that since we're creating an executable, we retain `main.rs` as the source
37+
filename. If we want to make a library instead, we should use `lib.rs`. This
38+
convention is used by Cargo to successfully compile our projects, but it can be
39+
overridden if we wish. Custom file locations for the entry point can be
40+
specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
4041

4142
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
4243

@@ -63,8 +64,8 @@ version = "0.0.1"
6364
authors = [ "Your name <[email protected]>" ]
6465
```
6566

66-
This file is in the [TOML][toml] format. TOML is similar to INI, but has some
67-
extra goodies. According to the TOML docs,
67+
This file is in the [TOML][toml] format. TOML is similar to INI, but has some
68+
extra goodies. According to the TOML docs,
6869

6970
> TOML aims to be a minimal configuration file format that's easy to read due
7071
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
@@ -73,7 +74,8 @@ extra goodies. According to the TOML docs,
7374
7475
[toml]: https://github.com/toml-lang/toml
7576

76-
Once you have this file in place, we should be ready to build! To do so, run:
77+
Once we have this file in place in our project's root directory, we should be
78+
ready to build! To do so, run:
7779

7880
```bash
7981
$ cargo build

0 commit comments

Comments
 (0)