-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Minor documentation fixes #22027
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
Minor documentation fixes #22027
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ match x { | |
| `match` takes an expression and then branches based on its value. Each *arm* of | ||
| the branch is of the form `val => expression`. When the value matches, that arm's | ||
| expression will be evaluated. It's called `match` because of the term 'pattern | ||
| matching', which `match` is an implementation of. | ||
| matching,' which `match` is an implementation of. | ||
|
||
|
|
||
| So what's the big advantage here? Well, there are a few. First of all, `match` | ||
| enforces *exhaustiveness checking*. Do you see that last arm, the one with the | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ multiplications later, and we have our area. | |
| ## Chaining method calls | ||
|
|
||
| So, now we know how to call a method, such as `foo.bar()`. But what about our | ||
| original example, `foo.bar().baz()`? This is called 'method chaining', and we | ||
| original example, `foo.bar().baz()`? This is called 'method chaining,' and we | ||
|
||
| can do it by returning `self`. | ||
|
|
||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ Rust has two main types of strings: `&str` and `String`. | |
|
|
||
| # &str | ||
|
|
||
| The first kind is a `&str`. This is pronounced a 'string slice'. | ||
| The first kind is a `&str`. This is pronounced a 'string slice.' | ||
|
||
| String literals are of the type `&str`: | ||
|
|
||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -308,7 +308,7 @@ crate to allow) and of course requires an `unsafe` block. | |
| ## Assembly template | ||
|
|
||
| The `assembly template` is the only required parameter and must be a | ||
| literal string (i.e `""`) | ||
| literal string (i.e. `""`) | ||
|
|
||
| ``` | ||
| #![feature(asm)] | ||
|
|
@@ -412,15 +412,15 @@ memory, `memory` should also be specified. | |
| ## Options | ||
|
|
||
| The last section, `options` is specific to Rust. The format is comma | ||
| separated literal strings (i.e `:"foo", "bar", "baz"`). It's used to | ||
| separated literal strings (i.e. `:"foo", "bar", "baz"`). It's used to | ||
| specify some extra info about the inline assembly: | ||
|
|
||
| Current valid options are: | ||
|
|
||
| 1. *volatile* - specifying this is analogous to | ||
| `__asm__ __volatile__ (...)` in gcc/clang. | ||
| 2. *alignstack* - certain instructions expect the stack to be | ||
| aligned a certain way (i.e SSE) and specifying this indicates to | ||
| aligned a certain way (i.e. SSE) and specifying this indicates to | ||
| the compiler to insert its usual stack alignment code | ||
| 3. *intel* - use intel syntax instead of the default AT&T. | ||
|
|
||
|
|
@@ -649,7 +649,7 @@ functionality that isn't hard-coded into the language, but is | |
| implemented in libraries, with a special marker to tell the compiler | ||
| it exists. The marker is the attribute `#[lang="..."]` and there are | ||
| various different values of `...`, i.e. various different "lang | ||
| items". | ||
| items." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, and should be single quotes actually |
||
|
|
||
| For example, `Box` pointers require two lang items, one for allocation | ||
| and one for deallocation. A freestanding program that uses the `Box` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2348,7 +2348,7 @@ impl<A, St, F> Iterator for Unfold<St, F> where F: FnMut(&mut St) -> Option<A> { | |
| /// iteration | ||
| #[derive(Clone)] | ||
| #[unstable(feature = "core", | ||
| reason = "may be renamed or replaced by range notation adapaters")] | ||
| reason = "may be renamed or replaced by range notation adapters")] | ||
| pub struct Counter<A> { | ||
| /// The current state the counter is at (next value to be yielded) | ||
| state: A, | ||
|
|
@@ -2359,7 +2359,7 @@ pub struct Counter<A> { | |
| /// Creates a new counter with the specified start/step | ||
| #[inline] | ||
| #[unstable(feature = "core", | ||
| reason = "may be renamed or replaced by range notation adapaters")] | ||
| reason = "may be renamed or replaced by range notation adapters")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these two changes are welcome, but totally unrelated
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess it's okay to leave this here. |
||
| pub fn count<A>(start: A, step: A) -> Counter<A> { | ||
| Counter{state: start, step: step} | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is unrelated and shouldn't be here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't want to create too much noise with trivial pull requests. Do you want me to open a new one for this issue?
(I don't have a clue about correct Rust coding style. But http://aturon.github.io/style/whitespace.html recommends it and I thought it would be good to have the official documentation align with it.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's all good! no PR is too small. That guideline is WIP, and I would say goes against most style stuff, so let's just leave this for now, since it's already here.