Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

book: typo fixes, wording improvements. #25334

Merged
merged 1 commit into from
May 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/doc/trpl/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Character::Digit(10);
Hand::Digit;
```

Both variants are named `Digit`, but since they’re scoped to the `enum` name,
Both variants are named `Digit`, but since they’re scoped to the `enum` name
there's no ambiguity.

Not supporting these operations may seem rather limiting, but it’s a limitation
which we can overcome. There are two ways: by implementing equality ourselves,
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Because these kinds of situations are relatively rare, use panics sparingly.

In certain circumstances, even though a function may fail, we may want to treat
it as a panic instead. For example, `io::stdin().read_line(&mut buffer)` returns
an `Result<usize>`, when there is an error reading the line. This allows us to
a `Result<usize>`, when there is an error reading the line. This allows us to
handle and possibly recover from error.

If we don't want to handle this error, and would rather just abort the program,
Expand Down
6 changes: 3 additions & 3 deletions src/doc/trpl/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ see why consumers matter.
As we've said before, an iterator is something that we can call the
`.next()` method on repeatedly, and it gives us a sequence of things.
Because you need to call the method, this means that iterators
are *lazy* and don't need to generate all of the values upfront.
This code, for example, does not actually generate the numbers
`1-100`, and just creates a value that represents the sequence:
can be *lazy* and not generate all of the values upfront. This code,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, all iterators are lazy, but this is good future-proofing :)

for example, does not actually generate the numbers `1-100`, instead
creating a value that merely represents the sequence:

```rust
let nums = 1..100;
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/lifetimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ With that in mind, let’s learn about lifetimes.
# Lifetimes

Lending out a reference to a resource that someone else owns can be
complicated, however. For example, imagine this set of operations:
complicated. For example, imagine this set of operations:

- I acquire a handle to some kind of resource.
- I lend you a reference to the resource.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ println!("v[0] is: {}", v[0]);

Same error: “use of moved value.” When we transfer ownership to something else,
we say that we’ve ‘moved’ the thing we refer to. You don’t need some sort of
special annotation here, it’s the default thing that Rust does.
special annotation here; it’s the default thing that Rust does.

## The details

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/primitive-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Let’s go over them by category:
Integer types come in two varieties: signed and unsigned. To understand the
difference, let’s consider a number with four bits of size. A signed, four-bit
number would let you store numbers from `-8` to `+7`. Signed numbers use
“two’s compliment representation”. An unsigned four bit number, since it does
“two’s complement representation”. An unsigned four bit number, since it does
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be changed from four bit to four-bit?

not need to store negatives, can store values from `0` to `+15`.

Unsigned types use a `u` for their category, and signed types use `i`. The `i`
Expand Down