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

Add error note to illegal code snippet #37425

Merged
merged 1 commit into from
Nov 9, 2016
Merged

Conversation

polo-language
Copy link
Contributor

Mark intentionally invalid code snippet in documentation as such with a comment. Similar comments used elsewhere in this file.

r? @steveklabnik

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

Just a little update to do and it'll be good.

@@ -61,7 +61,7 @@ write something like this:

```rust,ignore
struct Point {
mut x: i32,
mut x: i32, // this causes an error
Copy link
Member

Choose a reason for hiding this comment

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

"This causes an error."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copied this comment (capitalization, punctuation, spacing) from line 87 of the same file for consistency. The code sample comments in this file (lines 85, 87, and 237-238) are all lower case and without periods (terminating ellipsis at line 237). Formatting is similar in other files, e.g. "mutability.md", "traits.md". Let me know.

Copy link
Member

Choose a reason for hiding this comment

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

Yurk. Well, they shouldn't be. If you want you can fix them as well (in this PR or another, as you want).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would like to confirm as it will affect a bunch of files which are already fairly consistent in their current style.
Here are some examples:

benchmark-tests.md:113
- // note lack of;(could also use an explicitreturn)
+ // Note lack of;(could also use an explicitreturn).

casting-between-types.md:109
- let a = 300 as *const char; // a pointer to location 300
+ let a = 300 as *const char; // A pointer to location 300.
OR as a sentence with predicate:
+ let a = 300 as *const char; // 'a' is a pointer to location 300.

traits.md:422
- // can be called with T == i32
+ // Can be called with T == i32.

traits.md:479
- true // overrides the expected value of is_invalid()
+ true // Overrides the expected value of is_invalid().

choosing-your-guarantees.md:293-296
let guard = mutex.lock();
- // guard dereferences mutably to the inner type
+ // 'guard' dereferences mutably to the inner type.

There's only an empty stub here on the topic: http://aturon.github.io/style/comments.html#code-snippets
Nothing on the topic here: https://github.com/rust-lang-nursery/fmt-rfcs/blob/master/guide/guide.md

Copy link
Member

Choose a reason for hiding this comment

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

Your proposed changes are far better and it's exactly what I meant.

@steveklabnik
Copy link
Member

r? @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Nov 8, 2016

📌 Commit 635ed48 has been approved by GuillaumeGomez

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Nov 8, 2016
Add error note to illegal code snippet

Mark intentionally invalid code snippet in documentation as such with a comment. Similar comments used elsewhere in this file.

r? @steveklabnik
bors added a commit that referenced this pull request Nov 9, 2016
Rollup of 8 pull requests

- Successful merges: #35102, #37425, #37483, #37588, #37601, #37610, #37650, #37652
- Failed merges:
@bors bors merged commit 635ed48 into rust-lang:master Nov 9, 2016
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.

5 participants