Commit Graph

1557 Commits

Author SHA1 Message Date
Carol (Nichols || Goulding)
fdd28f7e66 Resolve comments in Anatomy of a Rust Program 2016-07-05 19:18:05 -04:00
Carol (Nichols || Goulding)
ff08e0608d Backport changes to control flow 2016-07-05 19:18:04 -04:00
Carol (Nichols || Goulding)
6086b96384 Backport changes to comments section 2016-07-05 19:18:04 -04:00
Carol (Nichols || Goulding)
3b6c3090a6 Backport changes to functions section 2016-07-05 19:18:04 -04:00
Carol (Nichols || Goulding)
7ad59a1a9e Backport changes to scalar/compound data types sections 2016-07-05 19:18:04 -04:00
Carol (Nichols || Goulding)
8bf85b6a58 Backport changes to Variable Bindings in Detail section 2016-07-05 19:18:04 -04:00
Carol (Nichols || Goulding)
e094c3bd4e Backport addition of Anatomy of a Rust Program section 2016-07-05 19:18:02 -04:00
Carol (Nichols || Goulding)
b5064f0ce7 Backport edits made to Up and Running section 2016-07-05 19:17:38 -04:00
Carol (Nichols || Goulding)
9f3d17f8d5 Remove redundant "Chapter X" from sidebar
Fixes #124.
2016-07-05 15:00:58 -04:00
Carol (Nichols || Goulding)
ab0e9ab406 Merge pull request #119 from JIghtuse/master
chapter3: Fix multiple-argument functions signatures
2016-07-05 11:23:48 -04:00
Carol (Nichols || Goulding)
86e35395ec Fix another rename I messed up 2016-07-03 14:37:06 -04:00
Carol (Nichols || Goulding)
7ac400d560 Rework the match example to be about coin sorting
Fixes #115.

Thanks to some brainstorming with @pindell-matt and @selfup at Turing,
we've got what I think is a better analogy of a coin sorting machine!
2016-07-01 20:57:30 -06:00
Carol (Nichols || Goulding)
2590356475 Clear up the last sentence of the if let section a bit 2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
622b4ac83f Clarify talking about println! in prose
- Make code
- Avoid expression/statement confusion by not saying either of those
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
957eb7e517 Show the variable declaration in this example
I think the variable declaration makes this clearer, in case the reader
wants to copy-paste and play with it.
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
30604a5fe8 Connect exhaustiveness checking to $1B mistake
Connects to #112. Thanks @aturon!
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
f42b92d769 Clarify some points about the code in match arms
- Change the example to have an arm with multiple lines
- Explain the deal with multiple lines
- Emphasize that these are expressions

Connects to #112. Thank you @aturon!
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
5effbd5a93 Skip match exhaustiveness not being perfect
Connects to #112. Thank you @aturon!
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
df9adca27d Add a paragraph connecting Option to the $1B mistake
Fixes #111. Thank you @aturon!
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
b59a62e0e6 Compare enum syntax to struct syntax
Closes #106. Thank you @aturon!
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
b1d3ceb269 Be less dogmatic about idiomatic
Connects to #106.
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
c7979df8b2 Give more enum motivation in the intro paragraph
Taking suggestions from @aturon. I like how this foreshadows why this
chapter has sections on patterns.

Connects to #106.
2016-07-01 18:56:46 -06:00
Carol (Nichols || Goulding)
b113cc9014 Simplify and clarify match guards
I feel like the precedence issues are a bit too nuanced and not worth
spending time on. Match guards can be useful, though.

Fixes #115 at this point, in my view.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
9e292dfa6d Clarify and simplify using _ to ignore parts of bindings
I feel like destructuring tuples and struct fields is less common. I do
think it's worth pointing out that _ doesn't bind, though.

Connects to #115.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
1051a43504 Clarify the code examples in the ref/ref mut patterns section
Connects to #115.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
418c62e034 Give multiple patterns and ranges more motivation and move them together
I feel like these are useful for the same reasons, are very similar, and
should therefore be discussed in quick succession.

Connects to #115.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
97c870f7bb Give the patterns section a better ending
That leads into the next section like the other sections do.

Closes #114.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
cefbd7f16d Remove some of the less-commonly-used pattern abilities
Connects to #115. Not fixes, because I'm going to give some of these
more motivation before I think we can say we've covered what a new
rustacean *needs* to know.

Connects to #114 because I removed the trailing off last section, but I
do want to give this section a real ending.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
f6e536a1a2 Reorder so patterns is after match like the lead-in says
Fixes #113.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
7dd27c66c2 Annotate numeric types so the error message doesn't have _
I think having a better error message will be less confusing than the
type annotations here. I think the type annotations might actually help
because now it's clearer that `i8` is `T` in this case.

Also this error message has changed.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
e5a638b4c7 Hard wrap at 80 chars 2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
8f62f51e74 Make the verb tense consistent 2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
8059a9301d Clarify expression/condition/value usage in context of match
Connects to #112. It gets a little confusing when we're talking about a
lot of nested expressions. The patterns aren't really getting matched to
the expression, they're matched to the resulting value of the
expression.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
59ed464072 Be more specific and detailed in a few places 2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
b508f9c5e7 Restore some leading-into-match text in the right spot
I did like the lead-in to why we would want match that was at the end of
the enum section that I took out because match wasn't the next section.
Put it back in Option since match is the next section after Option.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
2051794d20 Calling Option a type is a bit confusing imo
I mean, it *is*, but we said we were going to cover Option because it
was an enum, so it might be confusing to start calling it a type if the
reader hasn't fully understood that enums are types yet.
2016-07-01 18:56:45 -06:00
Carol (Nichols || Goulding)
4db3b220b0 The reader might not "have a handle on enums" here
Especially since we're only a small part of the way through this
section.
2016-07-01 18:56:44 -06:00
Carol (Nichols || Goulding)
b67b0522e8 Have enums lead into Option rather than match
Connects to #113.
2016-07-01 18:56:44 -06:00
Carol (Nichols || Goulding)
d6502d203f Spelling edits 2016-07-01 18:56:44 -06:00
Carol (Nichols || Goulding)
e89ff36d59 Phrasing edits 2016-07-01 18:56:44 -06:00
Carol (Nichols || Goulding)
3b4efffe4d Punctuation edits 2016-07-01 18:56:44 -06:00
Boris Egorov
e35482fb82 chapter3: Fix multiple-argument functions signatures 2016-06-30 17:49:08 +06:00
Carol (Nichols || Goulding)
7470b4c17e Hide a newline in a code example with hidden code
This looks nicer.

Connects to #106.
2016-06-29 22:08:50 -06:00
Carol (Nichols || Goulding)
7027c996c9 Change type from u32 to u8 to match IPv4 spec
Each segment of an ipv4 address can only be 0-255, so each of the
segments only need to be u8s.

If, however, this was done to not have to explain the difference between
u32 and u8, or if this would be distracting from the point about enums
trying to be made here, I would be fine reverting this change.
2016-06-29 19:10:22 -06:00
Carol (Nichols || Goulding)
5b6fb9d2c4 Fix messed up rename 2016-06-27 15:43:43 -06:00
Carol (Nichols || Goulding)
475ecc7679 Rename files to match the nostarch structure more closely 2016-06-27 15:35:52 -06:00
Carol (Nichols || Goulding)
54c47de023 Merge pull request #95 from justsostephen/master
Spelling correction and revised wording.
2016-06-27 17:31:59 -04:00
Carol (Nichols || Goulding)
5f39fe96bd Merge pull request #91 from Chris-O-Neill/master
Updated pronouns and rustup.sh output in installation.md.
2016-06-27 17:28:08 -04:00
Carol (Nichols || Goulding)
54d6e14adc Merge pull request #86 from xtian/patch-1
copy -> move
2016-06-27 17:18:36 -04:00
Carol (Nichols || Goulding)
23d375b35c Merge pull request #99 from lukelafountaine/master
remove extraneous and potentially confusing variable declaration
2016-06-27 17:16:40 -04:00