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

Use Self over specific type in return position #70694

Merged
merged 1 commit into from
Apr 3, 2020
Merged

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Apr 2, 2020

No description provided.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 2, 2020
@Centril
Copy link
Contributor

Centril commented Apr 2, 2020

r? @Centril @bors r+

@bors
Copy link
Contributor

bors commented Apr 2, 2020

📌 Commit f87afec has been approved by Centril

@rust-highfive rust-highfive assigned Centril and unassigned joshtriplett Apr 2, 2020
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 2, 2020
@petrochenkov
Copy link
Contributor

Self in non-generic/macro positions is harmful for code readability and searchability.

@joshtriplett
Copy link
Member

@petrochenkov I personally tend to find it an improvement. Searching should turn up the impl TypeName block that the methods appear in. And for readability, I find it easier to evaluate a type at a glance when it contains Self:

-> Self: a constructor
-> &mut Self: a method that supports chaining, such as a builder method

@Centril
Copy link
Contributor

Centril commented Apr 2, 2020

I agree with @joshtriplett. In particular, it's even better in rustdoc to see Self for reasons aforementioned.

Centril added a commit to Centril/rust that referenced this pull request Apr 2, 2020
Use Self over specific type in return position
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2020
Rollup of 7 pull requests

Successful merges:

 - rust-lang#70487 (Stabilize float::to_int_unchecked)
 - rust-lang#70595 (Remove unused discriminant reads from MIR bodies)
 - rust-lang#70691 (Improve docs in `AllocRef`)
 - rust-lang#70694 (Use Self over specific type in return position)
 - rust-lang#70700 (Expand on platform details of `include_xxx` macros)
 - rust-lang#70708 (Fix typo in u8::to_ascii_uppercase and u8::to_ascii_lowercase)
 - rust-lang#70716 (Unerase regions in infer_placeholder_type)

Failed merges:

r? @ghost
@bors bors merged commit c00a21c into rust-lang:master Apr 3, 2020
@tesuji tesuji deleted the self branch April 3, 2020 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants