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

Some more cleanups to syntax::print #62532

Merged
merged 30 commits into from
Jul 11, 2019

Conversation

Mark-Simulacrum
Copy link
Member

All of these changes should be functionally equivalent to previous code.

Each commit mostly stands alone and this PR is easiest to review by-commit.

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(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 Jul 9, 2019
@Mark-Simulacrum
Copy link
Member Author

(Feel free to reassign to someone else, I think anyone can do the review for this since it's just cleanup)

@petrochenkov
Copy link
Contributor

This has some conflicts with #62393 (with that PR token and ident printing have some extra arguments and don't fit into Display directly).

@rust-highfive

This comment has been minimized.

@Mark-Simulacrum
Copy link
Member Author

I can drop those commits -- maybe easiest to just wait after your PR lands?

@petrochenkov
Copy link
Contributor

I'll reassign #62393 to you then, otherwise it's unlikely to land soon.

@Mark-Simulacrum
Copy link
Member Author

I've dropped what I think are the conflicting commits from this PR.

@bors

This comment has been minimized.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 9, 2019

📌 Commit 9c672338e80aee5a437e106917efd5139a56f0a4 has been approved by petrochenkov

@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 Jul 9, 2019
@bors
Copy link
Contributor

bors commented Jul 10, 2019

☔ The latest upstream changes (presumably #62555) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 10, 2019
Presumably the code was from an older age of Rust and can now be written
much simpler.
These are somewhat ambiguous (beginning/end of what?) so it's better to
inline their one use into the code.
This is also easier to understand because the scan and print "tasks" are
separate, but previously were both called "print" or "pretty print."
It was always set to the string's length
Also moves it to pp::Printer from PrintState.
We're always indenting by INDENT_UNIT anyway
@Mark-Simulacrum
Copy link
Member Author

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Jul 10, 2019

📌 Commit 56a9237 has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 10, 2019
Centril added a commit to Centril/rust that referenced this pull request Jul 10, 2019
…p, r=petrochenkov

Some more cleanups to syntax::print

All of these changes should be functionally equivalent to previous code.

Each commit mostly stands alone and this PR is easiest to review by-commit.
bors added a commit that referenced this pull request Jul 10, 2019
Rollup of 5 pull requests

Successful merges:

 - #62275 (rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.)
 - #62465 (Sometimes generate storage statements for temporaries with type `!`)
 - #62481 (Use `fold` in `Iterator::last` default implementation)
 - #62493 (#62357: doc(ptr): add example for {read,write}_unaligned)
 - #62532 (Some more cleanups to syntax::print)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Jul 10, 2019
Rollup of 5 pull requests

Successful merges:

 - #62275 (rustc_mir: treat DropAndReplace as Drop + Assign in qualify_consts.)
 - #62465 (Sometimes generate storage statements for temporaries with type `!`)
 - #62481 (Use `fold` in `Iterator::last` default implementation)
 - #62493 (#62357: doc(ptr): add example for {read,write}_unaligned)
 - #62532 (Some more cleanups to syntax::print)

Failed merges:

r? @ghost
@bors bors merged commit 56a9237 into rust-lang:master Jul 11, 2019
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…crum

Remove unneeded access to pretty printer's `s` field in favor of deref

I found it taxing in some of my recent PRs touching the pretty printer to maintain consistency with the surrounding code, since the current code is all over the place about whether it uses `self.s.…()` or `self.…()` for invoking methods of `rustc_ast_pretty::pp::Printer`.

This PR standardizes on `self.…()` — relying on the `Deref` and `DerefMut` impls introduced by [rust-lang#62532](rust-lang@cab4532).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…crum

Remove unneeded access to pretty printer's `s` field in favor of deref

I found it taxing in some of my recent PRs touching the pretty printer to maintain consistency with the surrounding code, since the current code is all over the place about whether it uses `self.s.…()` or `self.…()` for invoking methods of `rustc_ast_pretty::pp::Printer`.

This PR standardizes on `self.…()` — relying on the `Deref` and `DerefMut` impls introduced by [rust-lang#62532](rust-lang@cab4532).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…crum

Remove unneeded access to pretty printer's `s` field in favor of deref

I found it taxing in some of my recent PRs touching the pretty printer to maintain consistency with the surrounding code, since the current code is all over the place about whether it uses `self.s.…()` or `self.…()` for invoking methods of `rustc_ast_pretty::pp::Printer`.

This PR standardizes on `self.…()` — relying on the `Deref` and `DerefMut` impls introduced by [rust-lang#62532](rust-lang@cab4532).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…crum

Remove unneeded access to pretty printer's `s` field in favor of deref

I found it taxing in some of my recent PRs touching the pretty printer to maintain consistency with the surrounding code, since the current code is all over the place about whether it uses `self.s.…()` or `self.…()` for invoking methods of `rustc_ast_pretty::pp::Printer`.

This PR standardizes on `self.…()` — relying on the `Deref` and `DerefMut` impls introduced by [rust-lang#62532](rust-lang@cab4532).
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.

4 participants