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

Faq tweaks: batch 1 #2

Merged
merged 15 commits into from
Jan 14, 2016
Merged

Faq tweaks: batch 1 #2

merged 15 commits into from
Jan 14, 2016

Conversation

aturon
Copy link

@aturon aturon commented Jan 13, 2016

Here's my first batch of edits to the FAQ, covering up through "Design Patterns".

I plan to get through the rest and open a second PR later today.

r? @brson @AndrewBrinker

If you're looking for a way to avoid handling [`Result`s][Result] in other people's code, there's always [`unwrap()`][unwrap], but it's probably not what you want. [`Result`][Result] is an indicator that some computation may or may not complete successfully. Requiring you to handle these failures explicitly is one of the ways that Rust encourages robustness. If you really don't want to handle an error, use [`unwrap()`][unwrap], but know that doing so means that the given code will cause the entire process to panic on failure, which is usually undesirable.
If you're looking for a way to avoid handling [`Result`s][Result] in other people's code, there's always [`unwrap()`][unwrap], but it's probably not what you want. [`Result`][Result] is an indicator that some computation may or may not complete successfully. Requiring you to handle these failures explicitly is one of the ways that Rust encourages robustness. Rust provides tools like the [`try!` macro][TryMacro] to make handling failures ergonomic.

If you really don't want to handle an error, use [`unwrap()`][unwrap], but know that doing so means that the given code will cause the entire process to panic on failure, which is usually undesirable.

Choose a reason for hiding this comment

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

nit: "entire thread" is more accurate

@aturon
Copy link
Author

aturon commented Jan 13, 2016

@glaebhoerl Thanks! Pushed a new commit to address your comments.

@@ -155,7 +162,7 @@ fn is_odd(x: i64) -> bool {
}
```

In each example, the last line of the function is the return value of that function. It is important to note that if a function ends in a semicolon, its return type will be `()`, indicating no returned value. Implicit returns must omit the semicolon to work.
In each example, the last line of the function is the return value of that function. It is important to note that if a block ends in a semicolon, its return type will be `()`, indicating no returned value. Implicit returns must omit the semicolon to work.
Copy link
Owner

Choose a reason for hiding this comment

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

Here you changed 'function' to 'block' while the rest of the sentence talks about 'return' types. I don't typically think of blocks as 'returning' something and haven't seen 'return' used this way. The preceding sentence is also talking about functions.

Copy link
Author

Choose a reason for hiding this comment

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

Hm, good point. To be honest I've never found the concept of "implicit return" to be a helpful way to think about what's going on here. Anyway, I'll back out this particular change.

@brson
Copy link
Owner

brson commented Jan 13, 2016

Thanks. These are good improvements.

brson added a commit that referenced this pull request Jan 14, 2016
@brson brson merged commit 031673a into brson:doc-contribs-faq Jan 14, 2016
brson pushed a commit that referenced this pull request Jan 20, 2016
Tweaks to the community and user groups page
brson pushed a commit that referenced this pull request Oct 13, 2016
brson pushed a commit that referenced this pull request Mar 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants