From bc3c41be9f70f7c289886563974714c9c15429a7 Mon Sep 17 00:00:00 2001 From: Jonathan Hansford Date: Thu, 30 Jul 2015 09:20:13 +0100 Subject: [PATCH 1/4] Clarifications for Hello, Cargo! Just a few minor changes to clarify a few things for someone new to Rust and Cargo. --- src/doc/trpl/hello-cargo.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index 8e479977887d7..273ea44c495d9 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -23,20 +23,21 @@ README][cargoreadme] for specific instructions about installing it. Let’s convert Hello World to Cargo. -To Cargo-ify our project, we need to do two things: Make a `Cargo.toml` -configuration file, and put our source file in the right place. Let's -do that part first: +To Cargo-ify our project, we need to do three things: Make a `Cargo.toml` +configuration file, put our source file in the right place, and get rid of the +old `main.exe`. Let's do that part first: ```bash $ mkdir src $ mv main.rs src/main.rs +$ rm main.exe ``` -Note that since we're creating an executable, we used `main.rs`. If we -want to make a library instead, we should use `lib.rs`. This convention is required -for Cargo to successfully compile our projects, but it can be overridden if we wish. -Custom file locations for the entry point can be specified -with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. +Note that since we're creating an executable, we retain `main.rs` as the source +filename. If we want to make a library instead, we should use `lib.rs`. This +convention is required for Cargo to successfully compile our projects, but it +can be overridden if we wish. Custom file locations for the entry point can be +specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. [crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target @@ -63,8 +64,8 @@ version = "0.0.1" authors = [ "Your name " ] ``` -This file is in the [TOML][toml] format. TOML is similar to INI, but has some -extra goodies. According to the TOML docs, +This file is in the [TOML][toml] format. TOML is similar to INI, but has some +extra goodies. According to the TOML docs, > TOML aims to be a minimal configuration file format that's easy to read due > to obvious semantics. TOML is designed to map unambiguously to a hash table. @@ -73,7 +74,8 @@ extra goodies. According to the TOML docs, [toml]: https://github.com/toml-lang/toml -Once you have this file in place, we should be ready to build! To do so, run: +Once you have this file in place in your project's root directory, we should be +ready to build! To do so, run: ```bash $ cargo build From c2b564557d3c2c4ff8ba530a533da643c29694f6 Mon Sep 17 00:00:00 2001 From: Jonathan Hansford Date: Thu, 30 Jul 2015 11:58:13 +0100 Subject: [PATCH 2/4] By default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guessing Game states that "Rust only imports a few things into every program, the ‘prelude’". That isn't strictly true. That is all it imports by default and the change clarifies that point. --- src/doc/trpl/guessing-game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index 1784c253f7f47..b9063ffaa3420 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -98,8 +98,8 @@ use std::io; We’ll need to take user input, and then print the result as output. As such, we need the `io` library from the standard library. Rust only imports a few things -into every program, [the ‘prelude’][prelude]. If it’s not in the prelude, -you’ll have to `use` it directly. +by default into every program, [the ‘prelude’][prelude]. If it’s not in the +prelude, you’ll have to `use` it directly. [prelude]: ../std/prelude/index.html From d9b18822489f5734eed9698beef3b0076d0ab9b3 Mon Sep 17 00:00:00 2001 From: Jonathan Hansford Date: Mon, 3 Aug 2015 10:22:03 +0100 Subject: [PATCH 3/4] Updated in response to review --- src/doc/trpl/hello-cargo.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index 273ea44c495d9..7df04792ec830 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -8,13 +8,13 @@ so it is assumed that Rust projects will use Cargo from the beginning. [cratesio]: http://doc.crates.io Cargo manages three things: building your code, downloading the dependencies -your code needs, and building those dependencies. At first, your -program doesn’t have any dependencies, so we’ll only be using the first part of -its functionality. Eventually, we’ll add more. Since we started off by using -Cargo, it'll be easy to add later. +your code needs, and building those dependencies. At first, your program doesn’t +have any dependencies, so we’ll only be using the first part of its +functionality. Eventually, we’ll add more. Since we started off by using Cargo, +it'll be easy to add later. -If you installed Rust via the official installers you will also have Cargo. If -you installed Rust some other way, you may want to [check the Cargo +If we installed Rust via the official installers we will also have Cargo. If we +installed Rust some other way, we may want to [check the Cargo README][cargoreadme] for specific instructions about installing it. [cargoreadme]: https://github.com/rust-lang/cargo#installing-cargo-from-nightlies @@ -25,18 +25,18 @@ Let’s convert Hello World to Cargo. To Cargo-ify our project, we need to do three things: Make a `Cargo.toml` configuration file, put our source file in the right place, and get rid of the -old `main.exe`. Let's do that part first: +old executable (`main.exe` on Windows, `main` everywhere else). Let's do that part first: ```bash $ mkdir src $ mv main.rs src/main.rs -$ rm main.exe +$ rm main # or main.exe on Windows ``` Note that since we're creating an executable, we retain `main.rs` as the source filename. If we want to make a library instead, we should use `lib.rs`. This convention is required for Cargo to successfully compile our projects, but it -can be overridden if we wish. Custom file locations for the entry point can be +can be overridden if we wish. Custom file locations for the entry point can be specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. [crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target From c54df0e4541f66d43109c844782c43a2bd24d97d Mon Sep 17 00:00:00 2001 From: Jonathan Hansford Date: Mon, 3 Aug 2015 21:37:15 +0100 Subject: [PATCH 4/4] required -> used; you -> we --- src/doc/trpl/hello-cargo.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index 7df04792ec830..4bd7de23f0cd6 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -35,8 +35,8 @@ $ rm main # or main.exe on Windows Note that since we're creating an executable, we retain `main.rs` as the source filename. If we want to make a library instead, we should use `lib.rs`. This -convention is required for Cargo to successfully compile our projects, but it -can be overridden if we wish. Custom file locations for the entry point can be +convention is used by Cargo to successfully compile our projects, but it can be +overridden if we wish. Custom file locations for the entry point can be specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. [crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target @@ -74,7 +74,7 @@ extra goodies. According to the TOML docs, [toml]: https://github.com/toml-lang/toml -Once you have this file in place in your project's root directory, we should be +Once we have this file in place in our project's root directory, we should be ready to build! To do so, run: ```bash