From f63a103270ec8416899675a9cdb1c5cf6d77a498 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Mon, 17 Jun 2019 01:56:00 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Consistently=20use=20quotation=20marks=20ar?= =?UTF-8?q?ound=20=E2=80=9CHello,=20world!=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ch00-00-introduction.md | 2 +- src/ch01-02-hello-world.md | 6 +++--- src/ch01-03-hello-cargo.md | 24 ++++++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ch00-00-introduction.md b/src/ch00-00-introduction.md index 7a37ee4ef4..86fe469f9c 100644 --- a/src/ch00-00-introduction.md +++ b/src/ch00-00-introduction.md @@ -104,7 +104,7 @@ chapters. In concept chapters, you’ll learn about an aspect of Rust. In projec chapters, we’ll build small programs together, applying what you’ve learned so far. Chapters 2, 12, and 20 are project chapters; the rest are concept chapters. -Chapter 1 explains how to install Rust, how to write a Hello, world! program, +Chapter 1 explains how to install Rust, how to write a “Hello, world!” program, and how to use Cargo, Rust’s package manager and build tool. Chapter 2 is a hands-on introduction to the Rust language. Here we cover concepts at a high level, and later chapters will provide additional detail. If you want to get diff --git a/src/ch01-02-hello-world.md b/src/ch01-02-hello-world.md index e82ba49670..82a545ab63 100644 --- a/src/ch01-02-hello-world.md +++ b/src/ch01-02-hello-world.md @@ -20,7 +20,7 @@ we suggest making a *projects* directory in your home directory and keeping all your projects there. Open a terminal and enter the following commands to make a *projects* directory -and a directory for the Hello, world! project within the *projects* directory. +and a directory for the “Hello, world!” project within the *projects* directory. For Linux, macOS, and PowerShell on Windows, enter this: @@ -86,7 +86,7 @@ program. That makes you a Rust programmer—welcome! ### Anatomy of a Rust Program -Let’s review in detail what just happened in your Hello, world! program. +Let’s review in detail what just happened in your “Hello, world!” program. Here’s the first piece of the puzzle: ```rust @@ -178,7 +178,7 @@ From here, you run the *main* or *main.exe* file, like this: $ ./main # or .\main.exe on Windows ``` -If *main.rs* was your Hello, world! program, this line would print `Hello, +If *main.rs* was your “Hello, world!” program, this line would print `Hello, world!` to your terminal. If you’re more familiar with a dynamic language, such as Ruby, Python, or diff --git a/src/ch01-03-hello-cargo.md b/src/ch01-03-hello-cargo.md index 34428e5f94..b40be39da5 100644 --- a/src/ch01-03-hello-cargo.md +++ b/src/ch01-03-hello-cargo.md @@ -6,9 +6,9 @@ such as building your code, downloading the libraries your code depends on, and building those libraries. (We call libraries your code needs *dependencies*.) The simplest Rust programs, like the one we’ve written so far, don’t have any -dependencies. So if we had built the Hello, world! project with Cargo, it would -only use the part of Cargo that handles building your code. As you write more -complex Rust programs, you’ll add dependencies, and if you start a project +dependencies. So if we had built the “Hello, world!” project with Cargo, it +would only use the part of Cargo that handles building your code. As you write +more complex Rust programs, you’ll add dependencies, and if you start a project using Cargo, adding dependencies will be much easier to do. Because the vast majority of Rust projects use Cargo, the rest of this book @@ -29,7 +29,7 @@ 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 +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: @@ -99,10 +99,10 @@ 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 previous project and the -project Cargo generates are that Cargo placed the code in the *src* directory, -and we have a *Cargo.toml* configuration file in the top directory. +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 previous project and +the project Cargo generates 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 top-level project directory is just for README files, license information, @@ -110,14 +110,14 @@ configuration files, and anything else not related to your code. Using Cargo helps you organize your projects. There’s a place for everything, and everything is in its place. -If you started a project that doesn’t use Cargo, as we did with the Hello, -world! project, you can convert it to a project that does use Cargo. Move the +If you started a project that doesn’t use Cargo, as we did with the “Hello, +world!” project, you can convert it to a project that does use Cargo. Move the project code into the *src* directory and create an appropriate *Cargo.toml* file. ### Building and Running a Cargo Project -Now let’s look at what’s different when we build and run the Hello, world! +Now let’s look at what’s different when we build and run the “Hello, world!” program with Cargo! From your *hello_cargo* directory, build your project by entering the following command: @@ -237,7 +237,7 @@ you’ve learned how to: * Install the latest stable version of Rust using `rustup` * Update to a newer Rust version * Open locally installed documentation -* Write and run a Hello, world! program using `rustc` directly +* Write and run a “Hello, world!” program using `rustc` directly * Create and run a new project using the conventions of Cargo This is a great time to build a more substantial program to get used to reading From 27e741b227b6b946a1498ecc9d9dd1bff5819b82 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Mon, 17 Jun 2019 01:56:43 +0200 Subject: [PATCH 2/6] Clarify that it is not the installer that contains the documentation. --- src/ch01-01-installation.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ch01-01-installation.md b/src/ch01-01-installation.md index 9061389e6d..d7659ebab8 100644 --- a/src/ch01-01-installation.md +++ b/src/ch01-01-installation.md @@ -126,9 +126,9 @@ resources include [the Users forum][users] and [Stack Overflow][stackoverflow]. ### Local Documentation -The installer also includes a copy of the documentation locally, so you can -read it offline. Run `rustup doc` to open the local documentation in your -browser. +The installation of Rust also includes a copy of the documentation locally, so +you can read it offline. Run `rustup doc` to open the local documentation in +your browser. Any time a type or function is provided by the standard library and you’re not sure what it does or how to use it, use the application programming interface From c427a676393d001edc82f1a54a3b8026abcf9690 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Mon, 17 Jun 2019 02:26:29 +0200 Subject: [PATCH 3/6] Clarify meaning. --- src/ch02-00-guessing-game-tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch02-00-guessing-game-tutorial.md b/src/ch02-00-guessing-game-tutorial.md index a992f192c0..2ecc1520ea 100644 --- a/src/ch02-00-guessing-game-tutorial.md +++ b/src/ch02-00-guessing-game-tutorial.md @@ -201,7 +201,7 @@ io::stdin().read_line(&mut guess) .expect("Failed to read line"); ``` -If we hadn’t listed the `use std::io` line at the beginning of the program, we +If we hadn’t put the `use std::io` line at the beginning of the program, we could have written this function call as `std::io::stdin`. The `stdin` function returns an instance of [`std::io::Stdin`][iostdin], which is a type that represents a handle to the standard input for your terminal. From 94e6df28d9068e806c17e3a283d2740718e6f8ea Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 23 Jun 2019 11:07:01 +0200 Subject: [PATCH 4/6] Improve wording. Especially the word "other" in this sentence is unclear, "other" than what/which? --- src/ch03-02-data-types.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index 228e4316b2..d2eeea65b9 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -228,9 +228,9 @@ primitive compound types: tuples and arrays. #### The Tuple Type -A tuple is a general way of grouping together some number of other values -with a variety of types into one compound type. Tuples have a fixed length: -once declared, they cannot grow or shrink in size. +A tuple is a general way of grouping together a number of values with a variety +of types into one compound type. Tuples have a fixed length: once declared, +they cannot grow or shrink in size. We create a tuple by writing a comma-separated list of values inside parentheses. Each position in the tuple has a type, and the types of the From 9fd678a9f28b010ea9a7edde13a0e8ff437f617c Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 23 Jun 2019 11:15:23 +0200 Subject: [PATCH 5/6] Clarification. --- src/ch03-02-data-types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index d2eeea65b9..4bd7091052 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -286,8 +286,8 @@ fn main() { ``` This program creates a tuple, `x`, and then makes new variables for each -element by using their index. As with most programming languages, the first -index in a tuple is 0. +element by using their respective indices. As with most programming languages, +the first index in a tuple is 0. #### The Array Type From 6598d3abac05ed1d0c45db92466ea49346d05e40 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 23 Jun 2019 11:26:10 +0200 Subject: [PATCH 6/6] Avoid mixing up the words elements and array/items. --- src/ch03-02-data-types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index 4bd7091052..482e69f73f 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -318,7 +318,7 @@ vector. Chapter 8 discusses vectors in more detail. An example of when you might want to use an array rather than a vector is in a program that needs to know the names of the months of the year. It’s very unlikely that such a program will need to add or remove months, so you can use -an array because you know it will always contain 12 items: +an array because you know it will always contain 12 elements: ```rust let months = ["January", "February", "March", "April", "May", "June", "July", @@ -334,7 +334,7 @@ let a: [i32; 5] = [1, 2, 3, 4, 5]; ``` Here, `i32` is the type of each element. After the semicolon, the number `5` -indicates the element contains five items. +indicates the array contains five elements. Writing an array’s type this way looks similar to an alternative syntax for initializing an array: if you want to create an array that contains the same