-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc_ast_pretty
cleanups
#117928
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
rustc_ast_pretty
cleanups
#117928
Conversation
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
☔ The latest upstream changes (presumably #117979) made this pull request unmergeable. Please resolve the merge conflicts. |
77e4a2b
to
92f16c7
Compare
Because the API for `with_position` improved in 0.11 and I want to use it.
itertools has `with_position` which does the same thing.
This makes `rustc_hir_pretty` more like `rustc_ast_pretty`.
`PrintState` is a trait containing code that can be used by both AST and HIR pretty-printing. But several of its methods are only used by AST printing. This commit moves those methods out of the trait and into the AST `State` impl, so they are not exposed unnecessarily. This commit also removes four unused methods: `param_to_string`, `foreign_item_to_string`, `assoc_item_to_string`, and `print_inner_attributes_inline`.
The AST and HIR versions of `State::print_ident` are textually identical, but the types differ slightly. This commit factors out the common code they both have by replacing `print_ident` with `ann_post`, which is a smaller function that still captures the type difference.
92f16c7
to
b49d8f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review! Overall LGTM. r=me after one small nit.
b49d8f3
to
6686221
Compare
I addressed the nit. @bors r=fee1-dead |
☀️ Test successful - checks-actions |
Finished benchmarking commit (cc4bb0d): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 676.959s -> 676.862s (-0.01%) |
Some improvements I found while looking at this code.
r? @fee1-dead