Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Or follow the [instructions][install-dprint] on the `dprint` website.
[install-dprint]: https://dprint.dev/install/

To format Rust code, you can run `rustfmt <path to file>`, and to format other
files, you can pass `dprint <path to file>`. Many text editors also have native
files, you can pass `dprint fmt <path to file>`. Many text editors also have native
support or extensions for both `rustfmt` and `dprint`.

## Checking for Fixes
Expand Down
2 changes: 1 addition & 1 deletion src/ch05-03-method-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The `&self` is actually short for `self: &Self`. Within an `impl` block, the
type `Self` is an alias for the type that the `impl` block is for. Methods must
have a parameter named `self` of type `Self` for their first parameter, so Rust
lets you abbreviate this with only the name `self` in the first parameter spot.
Note that we still need to use the `&` in front of the `self` shorthand to
Note that we still need to use the `&` behind the `self` shorthand to
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct: it’s &self, not self: &!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Chris!

Can you please double check this?

From my understanding, the sentence I changed refers to this first sentence:
image

The sentences in between thoroughly explain how &self works under the hood, but it hints we'll never use self: &Self (only just &self), so that's why I assumed the sentence referenced to just &self.

Please lmk the intended meaning so that I can maybe change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

You’re corect that the sentence does refer to just &self; that’s exactly what “use the & i front of the self short hand” is saying. 😄 The & is “in front of” self here. There’s no need to change the sentence or its meaning; it’s already correct!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, thanks for clarifying! I've dropped that change.

Very have to contribute :)

indicate that this method borrows the `Self` instance, just as we did in
`rectangle: &Rectangle`. Methods can take ownership of `self`, borrow `self`
immutably, as we’ve done here, or borrow `self` mutably, just as they can any
Expand Down
Loading