-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Avoid PartialEq in book explanation of enums #21207
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
else if a > b { Ordering::Greater } | ||
else { Ordering::Equal } | ||
} | ||
```{rust, norun} |
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.
I don't remember how you tell rustdoc not to test this example (if this is wrong)...I'll look it up later
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 {rust,ignore}
. See intro for examples.
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.
Fixed
fd4c32a
to
27cc058
Compare
|
||
You can also have any number of values in an enum: | ||
let nine = Character::Digit(9i32); | ||
let not_a_digit = Other; |
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.
Self note: should be Character::Other
Hey, sorry for taking a while to review this. :( The reason I cover |
@steveklabnik How come when @alexcrichton closes things we can reopen but when you close things we can't? Is that an admin option? It also blocks modifying the branch so we can ask for review again. We'd have to make a new PR. I didn't know |
@mdinger I have no idea what you're talking about. @alexcrichton and I have the same permissions, and, I'd imagine, clicked the same close button. I closed becuase I'd imagine that totally re-doing it would end up being a new PR. |
@steveklabnik Things like here: #20601 (comment) Maybe I just made a mistake and assumed that meant we could reopen. I thought I'd seen it reopened but can't find one. |
This was a quick rewrite to try and address #21196. I doubt the tone is as light as when @steveklabnik usually writes so it may be a little out of place. I prefer it a little drier but opinions vary.
I figure better to use
match
and ask the reader for patience as it's covered in more detail in the next section than to take a complicated route through PartialEq and such to avoidmatch
.I also tried to elaborate a little on
Other
because I thought the first seeing of a type without data is pretty weird. I'm hoping for comments to see if others think it's better as well.