Skip to content

Commit

Permalink
Fancy quotes everywhere!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Jul 18, 2017
1 parent 70128c8 commit d06a6a1
Show file tree
Hide file tree
Showing 77 changed files with 1,631 additions and 1,631 deletions.
2 changes: 1 addition & 1 deletion second-edition/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
- [Accepting Command Line Arguments](ch12-01-accepting-command-line-arguments.md)
- [Reading a File](ch12-02-reading-a-file.md)
- [Refactoring to Improve Modularity and Error Handling](ch12-03-improving-error-handling-and-modularity.md)
- [Testing the Library's Functionality](ch12-04-testing-the-librarys-functionality.md)
- [Testing the Librarys Functionality](ch12-04-testing-the-librarys-functionality.md)
- [Working with Environment Variables](ch12-05-working-with-environment-variables.md)
- [Writing Error Messages to `stderr` Instead of `stdout`](ch12-06-writing-to-stderr-instead-of-stdout.md)

Expand Down
8 changes: 4 additions & 4 deletions second-edition/src/appendix-02-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ operators, before the expression they apply to.
* `!`
: Logical negation. On the boolean type, this flips between `true` and
`false`. On integer types, this inverts the individual bits in the
two's complement representation of the value.
twos complement representation of the value.
* `&` and `&mut`
: Borrowing. When applied to a value, these operators produce a
reference (pointer) to that value. The value is also placed into
Expand Down Expand Up @@ -86,8 +86,8 @@ equivalent to logical `&&`, `||` and `!=` evaluated in non-lazy fashion.
#### Lazy boolean operators

The operators `||` and `&&` may be applied to operands of boolean type. The
`||` operator denotes logical 'or', and the `&&` operator denotes logical
'and'. They differ from `|` and `&` in that the right-hand operand is only
`||` operator denotes logical ‘or’, and the `&&` operator denotes logical
and. They differ from `|` and `&` in that the right-hand operand is only
evaluated when the left-hand operand does not already determine the result of
the expression. That is, `||` only evaluates its right-hand operand when the
left-hand operand evaluates to `false`, and `&&` only when it evaluates to
Expand Down Expand Up @@ -142,7 +142,7 @@ fn average(values: &[f64]) -> f64 {
Some of the conversions which can be done through the `as` operator
can also be done implicitly at various points in the program, such as
argument passing and assignment to a `let` binding with an explicit
type. Implicit conversions are limited to "harmless" conversions that
type. Implicit conversions are limited to harmless conversions that
do not lose information and which have minimal or no risk of
surprising side-effects on the dynamic execution semantics.

Expand Down
6 changes: 3 additions & 3 deletions second-edition/src/ch01-00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ well as those from languages like Python who are looking for ways to write code
that performs better without sacrificing expressiveness.

Rust performs the majority of its safety checks and memory management decisions
at compile time, so that your program's runtime performance isn't impacted. This
at compile time, so that your programs runtime performance isnt impacted. This
makes it useful in a number of use cases that other languages aren’t good at:
programs with predictable space and time requirements, embedding in other
languages, and writing low-level code, like device drivers and operating
systems. It's also great for web applications: it powers the Rust package
registry site, [crates.io]! We're excited to see what *you* create with Rust.
systems. Its also great for web applications: it powers the Rust package
registry site, [crates.io]! Were excited to see what *you* create with Rust.

[crates.io]: https://crates.io/

Expand Down
16 changes: 8 additions & 8 deletions second-edition/src/ch01-01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ connection to run the commands in this chapter, as we’ll be downloading Rust
from the internet.

We’ll be showing off a number of commands using a terminal, and those lines all
start with `$`. You don't need to type in the `$` character; they are there to indicate
start with `$`. You dont need to type in the `$` character; they are there to indicate
the start of each command. You’ll see many tutorials and examples around the web
that follow this convention: `$` for commands run as a regular user, and `#`
for commands you should be running as an administrator. Lines that don't start
for commands you should be running as an administrator. Lines that dont start
with `$` are typically showing the output of the previous command.

### Installing on Linux or Mac

If you're on Linux or a Mac, all you need to do is open a terminal and type
If youre on Linux or a Mac, all you need to do is open a terminal and type
this:

```text
Expand Down Expand Up @@ -79,7 +79,7 @@ $ rustup self uninstall

### Troubleshooting

If you've got Rust installed, you can open up a shell, and type this:
If youve got Rust installed, you can open up a shell, and type this:

```text
$ rustc --version
Expand All @@ -95,12 +95,12 @@ rustc x.y.z (abcabcabc yyyy-mm-dd)
If you see this, Rust has been installed successfully!
Congrats!

If you don't and you're on Windows, check that Rust is in your `%PATH%` system
If you dont and youre on Windows, check that Rust is in your `%PATH%` system
variable.

If it still isn't working, there are a number of places where you can get help.
If it still isnt working, there are a number of places where you can get help.
The easiest is [the #rust IRC channel on irc.mozilla.org][irc]<!-- ignore -->,
which you can access through [Mibbit][mibbit]. Go to that address, and you'll
which you can access through [Mibbit][mibbit]. Go to that address, and youll
be chatting with other Rustaceans (a silly nickname we call ourselves) who can
help you out. Other great resources include [the Users forum][users] and
[Stack Overflow][stackoverflow].
Expand All @@ -116,5 +116,5 @@ 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.

Any time there's a type or function provided by the standard library and you're
Any time theres a type or function provided by the standard library and youre
not sure what it does, use the API documentation to find out!
78 changes: 39 additions & 39 deletions second-edition/src/ch01-02-hello-world.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Hello, World!

Now that you have Rust installed, let’s write your first Rust program. It's
Now that you have Rust installed, let’s write your first Rust program. Its
traditional when learning a new language to write a little program to print the
text “Hello, world!” to the screen, and in this section, we'll follow that
text “Hello, world!” to the screen, and in this section, well follow that
tradition.

> Note: This book assumes basic familiarity with the command line. Rust itself
Expand All @@ -12,8 +12,8 @@ tradition.
### Creating a Project Directory

First, make a directory to put your Rust code in. Rust doesn't care where your code
lives, but for this book, we'd suggest making a *projects* directory in your
First, make a directory to put your Rust code in. Rust doesnt care where your code
lives, but for this book, wed 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 directory for this particular project:

Expand Down Expand Up @@ -48,7 +48,7 @@ Windows PowerShell:

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
an underscore to separate them. For example, youd use *hello_world.rs* rather
than *helloworld.rs*.

Now open the *main.rs* file you just created, and type the following code:
Expand All @@ -72,28 +72,28 @@ Hello, world!

On Windows, run `.\main.exe` instead of `./main`. Regardless of your
operating system, you should see the string `Hello, world!` print to the
terminal. If you did, then congratulations! You've officially written a Rust
terminal. If you did, then congratulations! Youve officially written a Rust
program. That makes you a Rust programmer! Welcome!

### Anatomy of a Rust Program

Now, let’s go over what just happened in your "Hello, world!" program in
detail. Here's the first piece of the puzzle:
Now, let’s go over what just happened in your Hello, world! program in
detail. Heres the first piece of the puzzle:

```rust
fn main() {

}
```

These lines define a *function* in Rust. The `main` function is special: it's
These lines define a *function* in Rust. The `main` function is special: its
the first thing that is run for every executable Rust program. The first line
says, “I’m declaring a function named `main` that has no parameters and returns
nothing.” If there were parameters, their names would go inside the
parentheses, `(` and `)`.

Also note that the function body is wrapped in curly braces, `{` and `}`. Rust
requires these around all function bodies. It's considered good style to put
requires these around all function bodies. Its considered good style to put
the opening curly brace on the same line as the function declaration, with one
space in between.

Expand All @@ -109,7 +109,7 @@ style is to indent with four spaces, not a tab.

The second important part is `println!`. This is calling a Rust *macro*,
which is how metaprogramming is done in Rust. If it were calling a function
instead, it would look like this: `println` (without the `!`). We'll discuss
instead, it would look like this: `println` (without the `!`). Well discuss
Rust macros in more detail in Appendix E, but for now you just need to know
that when you see a `!` that means that you’re calling a macro instead of a
normal function.
Expand All @@ -123,8 +123,8 @@ over, and the next one is ready to begin. Most lines of Rust code end with a

### Compiling and Running Are Separate Steps

In "Writing and Running a Rust Program", we showed you how to run a newly
created program. We'll break that process down and examine each step now.
In Writing and Running a Rust Program, we showed you how to run a newly
created program. Well break that process down and examine each step now.

Before running a Rust program, you have to compile it. You can use the Rust
compiler by entering the `rustc` command and passing it the name of your source
Expand All @@ -134,7 +134,7 @@ file, like this:
$ rustc main.rs
```

If you come from a C or C++ background, you'll notice that this is similar to
If you come from a C or C++ background, youll notice that this is similar to
`gcc` or `clang`. After compiling successfully, Rust should output a binary
executable, which you can see on Linux or OSX by entering the `ls` command in
your shell as follows:
Expand All @@ -144,7 +144,7 @@ $ ls
main main.rs
```

On Windows, you'd enter:
On Windows, youd enter:

```cmd
> dir /B %= the /B option says to only show the file names =%
Expand All @@ -153,14 +153,14 @@ main.rs
```

This shows we have two files: the source code, with the *.rs* extension, and the
executable (*main.exe* on Windows, *main* everywhere else). All that's left to
executable (*main.exe* on Windows, *main* everywhere else). All thats left to
do from here is run the *main* or *main.exe* file, like this:

```text
$ ./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
Expand All @@ -173,8 +173,8 @@ hand, they need to have a Ruby, Python, or JavaScript implementation installed
program. Everything is a tradeoff in language design.

Just compiling with `rustc` is fine for simple programs, but as your project
grows, you'll want to be able to manage all of the options your project has
and make it easy to share your code with other people and projects. Next, we'll
grows, youll want to be able to manage all of the options your project has
and make it easy to share your code with other people and projects. Next, well
introduce you to a tool called Cargo, which will help you write real-world Rust
programs.

Expand All @@ -186,8 +186,8 @@ Cargo takes care of 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 right now, you'd only be using the part of Cargo that can take
The simplest Rust programs, like the one weve written so far, don’t have any
dependencies, so right now, youd only be using the part of Cargo that can take
care of building your code. As you write more complex Rust programs, you’ll
want to add dependencies, and if you start off using Cargo, that will be a lot
easier to do.
Expand All @@ -208,7 +208,7 @@ installation to 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
Lets create a new project using Cargo and look at how it differs from our
project in `hello_world`. Go back to your projects directory (or wherever you
decided to put your code):

Expand All @@ -233,7 +233,7 @@ $ cd hello_cargo

We passed the `--bin` argument to `cargo new` because our goal is to make an
executable application, as opposed to a library. Executables are binary
executable files often called just *binaries*. We've given `hello_cargo`
executable files often called just *binaries*. Weve given `hello_cargo`
as the name for our project, and Cargo creates its files in a directory
of the same name that we can then go into.

Expand All @@ -258,7 +258,7 @@ authors = ["Your Name <you@example.com>"]
[dependencies]
```

This file is in the [*TOML*][toml]<!-- ignore --> (Tom's Obvious, Minimal
This file is in the [*TOML*][toml]<!-- ignore --> (Toms Obvious, Minimal
Language) format. TOML is similar to INI but has some extra goodies and is used
as Cargo’s configuration format.

Expand All @@ -276,11 +276,11 @@ file.

The last line, `[dependencies]`, is the start of a section for you to list any
*crates* (which is what we call packages of Rust code) that your project will
depend on so that Cargo knows to download and compile those too. We won't need
depend on so that Cargo knows to download and compile those too. We wont need
any other crates for this project, but we will in the guessing game tutorial in
the next chapter.

Now let's look at *src/main.rs*:
Now lets look at *src/main.rs*:

<span class="filename">Filename: src/main.rs</span>

Expand All @@ -290,27 +290,27 @@ fn main() {
}
```

Cargo has generated a "Hello World!" for you, just like the one we wrote
Cargo has generated a Hello World! for you, just like the one we wrote
earlier! So that part is the same. The differences between our previous project
and the project generated by Cargo that we've seen so far are:
and the project generated by Cargo that weve seen so far are:

- Our code goes in the *src* directory
- The top level contains a *Cargo.toml* configuration file

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
using Cargo helps you keep your projects nice and tidy. Theres a place for
everything, and everything is in its place.

If you started a project that doesn't use Cargo, as we did with our project in
If you started a project that doesnt use Cargo, as we did with our project in
the *hello_world* directory, you can convert it to a project that does use
Cargo by moving your code into the *src* directory and creating an appropriate
*Cargo.toml*.

### Building and Running a Cargo Project

Now let's look at what's different about building and running your Hello World
Now lets look at whats different about building and running your Hello World
program through Cargo! To do so, enter the following commands:

```text
Expand Down Expand Up @@ -340,8 +340,8 @@ version = "0.1.0"
```

Cargo uses the *Cargo.lock* 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
This project doesnt have dependencies, so the file is a bit sparse.
Realistically, you wont ever need to touch this file yourself; just let Cargo
handle it.

We just built a project with `cargo build` and ran it with
Expand All @@ -354,7 +354,7 @@ $ cargo run
Hello, world!
```

Notice that this time, we didn't see the output telling us that Cargo was
Notice that this time, we didnt see the output telling us that Cargo was
compiling `hello_cargo`. Cargo figured out that the files haven’t changed, so
it just ran the binary. If you had modified your source code, Cargo would have
rebuilt the project before running it, and you would have seen something like
Expand All @@ -367,15 +367,15 @@ $ cargo run
Hello, world!
```

So a few more differences we've now seen:
So a few more differences weve now seen:

- Instead of using `rustc`, build a project using `cargo build` (or build and
run it in one step with `cargo run`)
- Instead of the result of the build being put in the same directory as our
code, Cargo will put it in the *target/debug* directory.

The other advantage of using Cargo is that the commands are the same no matter
what operating system you're on, so at this point we will no longer be
what operating system youre on, so at this point we will no longer be
providing specific instructions for Linux and Mac versus Windows.

### Building for Release
Expand All @@ -386,14 +386,14 @@ executable in *target/release* instead of *target/debug*. These optimizations
make your Rust code run faster, but turning them on makes your program take
longer to compile. This is why there are two different profiles: one for
development when you want to be able to rebuild quickly and often, and one for
building the final program you’ll give to a user that won't be rebuilt and
that we want to run as fast as possible. If you're benchmarking the running
building the final program you’ll give to a user that wont be rebuilt and
that we want to run as fast as possible. If youre benchmarking the running
time of your code, be sure to run `cargo build --release` and benchmark with
the executable in *target/release*.

### Cargo as Convention

With simple projects, Cargo doesn't provide a whole lot of value over just
With simple projects, Cargo doesnt provide a whole lot of value over just
using `rustc`, but it will prove its worth as you continue. With complex
projects composed of multiple crates, it’s much easier to let Cargo coordinate
the build. With Cargo, you can just run `cargo build`, and it should work the
Expand Down
8 changes: 4 additions & 4 deletions second-edition/src/ch02-00-guessing-game-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ the project with the dependencies available.

If you immediately run `cargo build` again without making any changes, you won’t
get any output. Cargo knows it has already downloaded and compiled the
dependencies, and you haven't changed anything about them in your *Cargo.toml*
file. Cargo also knows that you haven't changed anything about your code, so it
doesn't recompile that either. With nothing to do, it simply exits. If you open
dependencies, and you havent changed anything about them in your *Cargo.toml*
file. Cargo also knows that you havent changed anything about your code, so it
doesnt recompile that either. With nothing to do, it simply exits. If you open
up the *src/main.rs* file, make a trivial change, then save it and build again,
you’ll only see one line of output:

Expand All @@ -424,7 +424,7 @@ $ cargo build
```

This line shows Cargo only updates the build with your tiny change to the
*src/main.rs* file. Your dependencies haven't changed, so Cargo knows it can
*src/main.rs* file. Your dependencies havent changed, so Cargo knows it can
reuse what it has already downloaded and compiled for those. It just rebuilds
your part of the code.

Expand Down
Loading

0 comments on commit d06a6a1

Please sign in to comment.