Simplify ast::UseTreeKind - #162794
Open
nnethercote wants to merge 3 commits into
Open
Simplify ast::UseTreeKind#162794nnethercote wants to merge 3 commits into
ast::UseTreeKind#162794nnethercote wants to merge 3 commits into
Conversation
It makes sense to put the top-level item first, before the use tree within the item. And it makes sense to have a single function-level comment explaining this rather than inline comments at the definition and every call site.
`is_public` is not relevant here.
`ast::UseTree` doesn't have an `id` field. The top-level use tree uses the item's id as its id, and nested use trees get their own id. This requires storing an id next to every nested use tree, which is awkward. This commit moves the id into `UseTree`. This means the top-level id is stored twice: once in the item, and once in the top-level use tree. This is worth it because it makes all the other code that handles use trees simpler, avoiding many `use_tree`/`id` pairs.
Collaborator
|
The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease
cc @rust-lang/rustfmt
cc @rust-lang/clippy |
Contributor
Author
Contributor
Author
|
LLM disclosure: some of the ideas for these changes came from an LLM. I made all the changes myself. |
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.
We can make things simpler by adjusting how the ids are stored. Details in individual commits.
r? @petrochenkov