Merge pull request #198 from terrynsun/filenames

Use inline code formatting for filenames.
This commit is contained in:
Carol (Nichols || Goulding)
2016-08-18 08:49:41 -04:00
committed by GitHub
4 changed files with 14 additions and 14 deletions
+11 -11
View File
@@ -29,12 +29,12 @@ $ cd hello_world
### Writing and Running a Rust Program
Next, make a new source file and call it *main.rs*. Rust files always end with
the *.rs* extension. If you’re using more than one word in your filename, use
an underscore to separate them. For example, you'd use *hello_world.rs* rather
than *helloworld.rs*.
Next, make a new source file and call it `main.rs`. Rust files always end with
the `.rs` extension. If you’re using more than one word in your filename, use
an underscore to separate them. For example, you'd use `hello_world.rs` rather
than `helloworld.rs`.
Now open the *main.rs* file you just created, and type the following code:
Now open the `main.rs` file you just created, and type the following code:
```rust
fn main() {
@@ -142,7 +142,7 @@ do from here is run the `main` or `main.exe` file, like this:
$ ./main # or main.exe on Windows
```
If *main.rs* were your "Hello, world!" program, this would print `Hello,
If `main.rs` were your "Hello, world!" program, this would print `Hello,
world!` to your terminal.
If you come from a dynamic language like Ruby, Python, or JavaScript, you may
@@ -212,8 +212,8 @@ name we've chosen for our project, and Cargo creates its files in a directory
of the same name that we can then go into.
If we list the files in the `hello_cargo` directory, we can see that Cargo has
generated two files and one directory for us: a `Cargo.toml` and a *src*
directory with a *main.rs* file inside. It has also initialized a new `git`
generated two files and one directory for us: a `Cargo.toml` and a `src`
directory with a `main.rs` file inside. It has also initialized a new `git`
repository in the `hello_cargo` directory for us; you can change this to use a
different version control system, or no version control system, by using the
`--vcs` flag.
@@ -266,7 +266,7 @@ and the project generated by Cargo that we've seen so far are:
1. Our code goes in the `src` directory
2. The top level contains a `Cargo.toml` configuration file
Cargo expects your source files to live inside the *src* directory so that the
Cargo expects your source files to live inside the `src` directory so that the
top-level project directory is just for READMEs, license information,
configuration files, and anything else not related to your code. In this way,
using Cargo helps you keep your projects nice and tidy. There's a place for
@@ -297,7 +297,7 @@ Hello, world!
Bam! If all goes well, `Hello, world!` should print to the terminal once more.
Running `cargo build` for the first time also causes Cargo to create a new file
at the top level called *Cargo.lock*, which looks like this:
at the top level called `Cargo.lock`, which looks like this:
```toml
[root]
@@ -305,7 +305,7 @@ name = "hello_cargo"
version = "0.1.0"
```
Cargo uses the *Cargo.lock* file to keep track of dependencies in your
Cargo uses the `Cargo.lock` file to keep track of dependencies in your
application. This project doesn't have dependencies, so the file is a bit
sparse. Realistically, you won't ever need to touch this file yourself; just
let Cargo handle it.
@@ -17,7 +17,7 @@ $ cargo new --bin bindings
$ cd bindings
```
Then open *src/main.rs* and replace its code with the following:
Then open `src/main.rs` and replace its code with the following:
```rust,ignore
fn main() {
+1 -1
View File
@@ -43,7 +43,7 @@ $ cargo new --bin functions
$ cd functions
```
Place the `another_function()` example in a file named *src/main.rs* and run
Place the `another_function()` example in a file named `src/main.rs` and run
it. You should see the following output:
```bash
+1 -1
View File
@@ -248,7 +248,7 @@ in.
The `loop` keyword tells Rust to execute a block of code over and over again
forever or until we explicitly tell it to stop.
For an example, change the *src/main.rs* file in your *loops* directory to look
For an example, change the `src/main.rs` file in your *loops* directory to look
like this:
```rust,ignore