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

replace Add example with something more evocative of addition #35709

Merged
merged 1 commit into from
Aug 20, 2016

Conversation

matthew-piziak
Copy link
Contributor

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 #29365

@matthew-piziak
Copy link
Contributor Author

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 @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
Copy link
Member

Choose a reason for hiding this comment

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

Add "" aroundPointandAdd`.

@GuillaumeGomez
Copy link
Member

Please squash your commits and it should be good to go.

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".
@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Aug 18, 2016

📌 Commit dcee93a has been approved by GuillaumeGomez

matthew-piziak added a commit to matthew-piziak/rust that referenced this pull request Aug 18, 2016
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 18, 2016
…=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 added a commit to steveklabnik/rust that referenced this pull request Aug 18, 2016
…=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR rust-lang#35709 for the `Add` trait.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 19, 2016
…=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
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 19, 2016
…=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR rust-lang#35709 for the `Add` trait.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 19, 2016
…=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
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 19, 2016
…=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR rust-lang#35709 for the `Add` trait.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 20, 2016
…=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
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 20, 2016
…=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR rust-lang#35709 for the `Add` trait.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 20, 2016
…=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
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 20, 2016
…=steveklabnik

replace `AddAssign` example with something more evocative of addition

This is analogous to PR rust-lang#35709 for the `Add` trait.
bors added a commit that referenced this pull request Aug 20, 2016
@bors bors merged commit dcee93a into rust-lang:master Aug 20, 2016
matthew-piziak added a commit to matthew-piziak/rust that referenced this pull request Aug 22, 2016
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
@matthew-piziak matthew-piziak deleted the add-trait-example branch August 23, 2016 15:12
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 24, 2016
…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
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.

6 participants