diff options
Diffstat (limited to 'src/doc/book/src/ch01-03-hello-cargo.md')
-rw-r--r-- | src/doc/book/src/ch01-03-hello-cargo.md | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/doc/book/src/ch01-03-hello-cargo.md b/src/doc/book/src/ch01-03-hello-cargo.md index 9979e76dd..42cd0889c 100644 --- a/src/doc/book/src/ch01-03-hello-cargo.md +++ b/src/doc/book/src/ch01-03-hello-cargo.md @@ -17,7 +17,7 @@ assumes that you’re using Cargo too. Cargo comes installed with Rust if you used the official installers discussed in the [“Installation”][installation]<!-- ignore --> section. If you installed Rust through some other means, check whether Cargo is installed by entering the -following into your terminal: +following in your terminal: ```console $ cargo --version @@ -30,9 +30,9 @@ determine how to install Cargo separately. ### Creating a Project with Cargo Let’s create a new project using Cargo and look at how it differs from our -original “Hello, world!” project. Navigate back to your *projects* directory (or -wherever you decided to store your code). Then, on any operating system, run -the following: +original “Hello, world!” project. Navigate back to your *projects* directory +(or wherever you decided to store your code). Then, on any operating system, +run the following: ```console $ cargo new hello_cargo @@ -74,8 +74,8 @@ edition = "2021" <span class="caption">Listing 1-2: Contents of *Cargo.toml* generated by `cargo new`</span> -This file is in the [*TOML*](https://toml.io)<!-- ignore --> (*Tom’s Obvious, -Minimal Language*) format, which is Cargo’s configuration format. +This file is in the [*TOML*][toml]<!-- ignore --> (*Tom’s Obvious, Minimal +Language*) format, which is Cargo’s configuration format. The first line, `[package]`, is a section heading that indicates that the following statements are configuring a package. As we add more information to @@ -102,7 +102,7 @@ fn main() { Cargo has generated a “Hello, world!” program for you, just like the one we wrote in Listing 1-1! So far, the differences between our project and the -project Cargo generated are that Cargo placed the code in the *src* directory, +project Cargo generated are that Cargo placed the code in the *src* directory and we have a *Cargo.toml* configuration file in the top directory. Cargo expects your source files to live inside the *src* directory. The @@ -147,7 +147,7 @@ manages its contents for you. We just built a project with `cargo build` and ran it with `./target/debug/hello_cargo`, but we can also use `cargo run` to compile the -code and then run the resulting executable all in one command: +code and then run the resultant executable all in one command: ```console $ cargo run @@ -184,7 +184,7 @@ $ cargo check ``` Why would you not want an executable? Often, `cargo check` is much faster than -`cargo build`, because it skips the step of producing an executable. If you’re +`cargo build` because it skips the step of producing an executable. If you’re continually checking your work while writing the code, using `cargo check` will speed up the process of letting you know if your project is still compiling! As such, many Rustaceans run `cargo check` periodically as they write their @@ -236,9 +236,7 @@ $ cd someproject $ cargo build ``` -For more information about Cargo, check out [its documentation]. - -[its documentation]: https://doc.rust-lang.org/cargo/ +For more information about Cargo, check out [its documentation][cargo]. ## Summary @@ -257,4 +255,6 @@ If you would rather start by learning how common programming concepts work in Rust, see Chapter 3 and then return to Chapter 2. [installation]: ch01-01-installation.html#installation +[toml]: https://toml.io [appendix-e]: appendix-05-editions.html +[cargo]: https://doc.rust-lang.org/cargo/ |