From f9bfebb79087e6aa37037561aa7b1748d24f53c9 Mon Sep 17 00:00:00 2001 From: Akshay Chiwhane Date: Fri, 5 Jun 2015 09:20:11 -0400 Subject: [PATCH 1/4] Clarified naming convention for Cargo Added a sentence that tells the user that using main.rs and/or lib.rs is required for Cargo. --- src/doc/trpl/hello-cargo.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index cc8747d1fa7c1..ee9c84a53b3cf 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -33,7 +33,8 @@ $ mv main.rs src/main.rs ``` 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`. +want to make a library instead, we should use `lib.rs`. This convention is required +for Cargo to successfully compile our projects. Custom file locations for the entry point can be specified with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below. From 629be845fdf58d34f5dc3bd1674ea57ebf3c9380 Mon Sep 17 00:00:00 2001 From: Akshay Chiwhane Date: Fri, 5 Jun 2015 09:50:27 -0400 Subject: [PATCH 2/4] edit for clarity and grammar --- src/doc/trpl/hello-cargo.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index ee9c84a53b3cf..ec7bcb4aacafa 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -63,18 +63,17 @@ version = "0.0.1" authors = [ "Your name " ] ``` -This file is in the [TOML][toml] format. Let’s let it explain itself to you: +This file is in the [TOML][toml] format. TOML is similar to INI, but has some +extra goodies. According to the Rust 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. > TOML should be easy to parse into data structures in a wide variety of > languages. -TOML is very similar to INI, but with some extra goodies. - [toml]: https://github.com/toml-lang/toml -Once you have this file in place, we should be ready to build! Try this: +Once you have this file in place, we should be ready to build! To do so, run: ```bash $ cargo build @@ -83,7 +82,7 @@ $ ./target/debug/hello_world Hello, world! ``` -Bam! We build our project with `cargo build`, and run it with +Bam! We built our project with `cargo build`, and ran it with `./target/debug/hello_world`. We can do both in one step with `cargo run`: ```bash @@ -104,9 +103,9 @@ Hello, world! ``` This hasn’t bought us a whole lot over our simple use of `rustc`, but think -about the future: when our project gets more complex, we would need to do more +about the future: when our project gets more complex, we need to do more things to get all of the parts to properly compile. With Cargo, as our project -grows, we can just `cargo build`, and it’ll work the right way. +grows, we can just run `cargo build`, and it’ll work the right way. When your project is finally ready for release, you can use `cargo build --release` to compile your project with optimizations. @@ -119,7 +118,7 @@ name = "hello_world" version = "0.0.1" ``` -This file is used by Cargo to keep track of dependencies in your application. +The `Cargo.lock` is used by Cargo to keep track of dependencies in your application. Right now, we don’t have any, so it’s a bit sparse. You won't ever need to touch this file yourself, just let Cargo handle it. From 455b93151dc3cedfdc7af5e066627da72a8532c4 Mon Sep 17 00:00:00 2001 From: Akshay Chiwhane Date: Fri, 5 Jun 2015 09:52:44 -0400 Subject: [PATCH 3/4] fix typo --- src/doc/trpl/hello-cargo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index ec7bcb4aacafa..381d792260672 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -118,7 +118,7 @@ name = "hello_world" version = "0.0.1" ``` -The `Cargo.lock` is used by Cargo to keep track of dependencies in your application. +The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application. Right now, we don’t have any, so it’s a bit sparse. You won't ever need to touch this file yourself, just let Cargo handle it. From ac3301ec3b71daee43a0ad5d671767d44d3280a4 Mon Sep 17 00:00:00 2001 From: Akshay Chiwhane Date: Fri, 5 Jun 2015 09:56:42 -0400 Subject: [PATCH 4/4] fix some errors --- src/doc/trpl/hello-cargo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index 381d792260672..32002ebd1ec2a 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -34,7 +34,7 @@ $ mv main.rs src/main.rs 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. +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 described below. @@ -64,7 +64,7 @@ authors = [ "Your name " ] ``` This file is in the [TOML][toml] format. TOML is similar to INI, but has some -extra goodies. According to the Rust docs, +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.