style-guide: Narrow guidance about references and dereferencing#113143
Merged
bors merged 1 commit intoJun 29, 2023
Merged
Conversation
The style guide advises "prefer dereferencing to taking references", but doesn't give guidance on when that "preference" should get overridden by other considerations. Give an example of when it's fine to ignore that advice.
Collaborator
|
(rustbot has picked a reviewer for you, use r? to override) |
Collaborator
|
Some changes occurred in src/doc/style-guide cc @rust-lang/style |
calebcartwright
approved these changes
Jun 29, 2023
calebcartwright
left a comment
Member
There was a problem hiding this comment.
To the best of my recollection, tools (e.g. rustfmt) don't attempt to make any modifications here so I view this as one of those "tips for the human programmer" vs something tools could enforce. rustfmt certainly couldn't make the determination around the degree of expense anyway 😄
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 29, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#112670 (privacy: Type privacy lints fixes and cleanups) - rust-lang#112929 (Test that we require implementing trait items whose bounds don't hold in the current impl) - rust-lang#113054 (Make `rustc_on_unimplemented` std-agnostic) - rust-lang#113137 (don't suggest `move` for borrows that aren't closures) - rust-lang#113139 (style-guide: Clarify let-else further) - rust-lang#113140 (style-guide: Add an example of formatting a multi-line attribute) - rust-lang#113143 (style-guide: Narrow guidance about references and dereferencing) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The style guide advises "prefer dereferencing to taking references", but
doesn't give guidance on when that "preference" should get overridden by
other considerations. Give an example of when it's fine to ignore
that advice.