-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
replace Add
example with something more evocative of addition
#35709
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. |
@@ -166,25 +166,38 @@ macro_rules! forward_ref_binop { | |||
/// | |||
/// # Examples | |||
/// | |||
/// A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up | |||
/// calling `add`, and therefore, `main` prints `Adding!`. | |||
/// This example creates a Point struct that implements Add, and then |
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.
Add "" around
Pointand
Add`.
Please squash your commits and it should be good to go. |
0807678
to
0f1eace
Compare
Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365 wrap identifiers in backticks minor rephrasing fix module-level documentation to be more truthful This branch changes the example for `Add` to no longer be a "minimum implementation that prints something to the screen".
1e83864
to
dcee93a
Compare
Thanks! @bors: r+ rollup |
📌 Commit dcee93a has been approved by |
This is analogous to PR rust-lang#35709 for the `Add` trait.
…=GuillaumeGomez replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365
…=steveklabnik replace `AddAssign` example with something more evocative of addition This is analogous to PR rust-lang#35709 for the `Add` trait.
…=GuillaumeGomez replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365
…=steveklabnik replace `AddAssign` example with something more evocative of addition This is analogous to PR rust-lang#35709 for the `Add` trait.
…=GuillaumeGomez replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365
…=steveklabnik replace `AddAssign` example with something more evocative of addition This is analogous to PR rust-lang#35709 for the `Add` trait.
…=GuillaumeGomez replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365
…=steveklabnik replace `AddAssign` example with something more evocative of addition This is analogous to PR rust-lang#35709 for the `Add` trait.
…=GuillaumeGomez replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of rust-lang#29365
…=steveklabnik replace `AddAssign` example with something more evocative of addition This is analogous to PR rust-lang#35709 for the `Add` trait.
These examples are exactly analogous to those in PRs rust-lang#35709 and rust-lang#35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of rust-lang#29365. r? @steveklabnik
…laumeGomez more evocative examples for `Sub` and `SubAssign` These examples are exactly analogous to those in PRs rust-lang#35709 and rust-lang#35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of rust-lang#29365. r? @steveklabnik
Currently most of the operator traits use trivial implementation
examples that only perform side effects. Honestly, that might not be too
bad for the sake of documentation; but anyway, here's a proposal to move
a slightly modified version of the module-level point-addition example
into the
Add
documentation, since it's more evocative of additionsemantics.
Part of #29365