Commit Graph

20 Commits

Author SHA1 Message Date
Jake Hickey
deee268015 Use a more descriptive variable name.
I'm currently reading the rust book and this variable name tripped me up.
Because it was called "input", I thought at first it might contain the line
read by read_line(). This new variable name will be more instructive to rust
beginners.
2015-06-22 18:48:50 -04:00
frankamp
ee4b58c792 Fixes consistency in before/after example
The doc indicates that you can replace 'before' with 'after' showing the use of try!. The two examples should be equivalent, but they are not.

In the File::create we were inducing a panic before in case of error, not propagating. It is important for newbies (like myself) to understand that try! propagates failures, while unwrap can induce a panic.

The other alternative is to make the 'before' File::create also manually handle Err like the other calls. Either way it would be consistent.
2015-05-30 13:31:46 -07:00
Pascal Hertleif
f3adea5ce9 TRPL: Normalize rust Code Block Markers
`{rust,ignore}` -> `rust,ignore
2015-05-18 21:10:00 +02:00
Swaroop C H
f6e5369e53 trpl/error-handling - fix typo 2015-05-13 13:23:10 -07:00
Swaroop C H
baef1327f4 Add link to Debug trait
I don't recall reading about this `Debug` trait so far in the book.
2015-05-13 09:49:11 -07:00
Shmuale Mark
a22b3270b8 book: typo fixes, wording improvements.
The text in iterators.md wasn't wrong, but it read awkwardly to my ear.
2015-05-12 11:58:07 -04:00
Isaac Ge
fa3fd813d6 Update error-handling.md
Fix two typos while `io::stdin().read_line()` returns `Result` actually

Signed-off-by: acgtyrant <acgtyrant@gmail.com>
2015-05-10 10:20:47 +08:00
Brendan Graetz
75a3e29042 =BG= minor: File::open --> File::create in rust book
- `FIle::open` is for opening a file in read-only mode
- `FIle::create` is for opening a file in write-only mode, which is what we want instead for this example to make sense
2015-05-03 20:42:47 +10:00
Steve Klabnik
a2ccc81f4b remove example usage of from_str in error docs
Fixes #24185
2015-04-16 23:50:16 -04:00
Florian Hartwig
16b60cf003 Fix some broken links in the book 2015-04-16 22:23:37 -04:00
fenduru
ab93a51068 Point to From trait in error handling guide
Not sure if `From<Error>` is the correct way to reference that trait (maybe `From<E: Error>`?)
2015-04-13 22:01:20 -04:00
kgv
343c110e76 Fix rust book error-handling.md for new std::io.
Fix example and some text for: `read_line` takes `&mut String` and return `Result` instead `IoResult`.
2015-04-01 09:37:19 +03:00
Steve Klabnik
f31ea22bff Mention try macro in error chapter
Fixes #22342
2015-02-24 12:31:46 -05:00
Jorge Aparicio
788181d405 s/Show/Debug/g 2015-01-29 07:49:02 -05:00
Nick Howell
0c26524134 doc: Remove extra whitespace in the middle of lines to provide alignment
"Idiomatic code should not use extra whitespace in the middle of a line to provide alignment."
http://aturon.github.io/style/whitespace.html

I realize the linked page still needs an RFC, but the docs should be written in accordance with the guidelines nevertheless.
2015-01-17 10:51:53 -05:00
Steve Klabnik
d5091c9cc9 Fix up titles of TRPL chapters 2015-01-17 10:51:07 -05:00
Paul Crowley
8eba032f52 Purge references to Rust tasks from TRPL. 2015-01-12 09:15:33 +00:00
Pascal Hertleif
6ff5ab1d01 Add Line Break to Robert Burns Quote 2015-01-10 15:47:52 +01:00
Kevin Yap
8f61814641 Standardize punctuation & formatting of TRPL
This commit is an attempt to standardize the use of punctuation and
formatting in "The Rust Programming Language" as discussed in #19823.

- Convert bold text to italicized textcwhen referring to terminology.
- Convert single-quoted text to italicized or double-quoted text,
  depending on context.
- Use double quotes only in the case of scare quotes or quotations.
2015-01-08 17:15:26 -08:00
Alex Crichton
7541f82fab Fix dead links in the guide and reorganize 2015-01-08 10:27:03 -08:00