-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Attribute cleanups #127308
Merged
Merged
Attribute cleanups #127308
Commits on Jul 4, 2024
-
Remove some unnecessary integer conversions.
These should have been removed in rust-lang#127233 when the positions were changed from `usize` to `u32`.
Configuration menu - View commit details
-
Copy full SHA for dd790ab - Browse repository at this point
Copy the full SHA dd790abView commit details
Commits on Jul 7, 2024
-
Rename
Attribute::tokens
(the inherent method).To distinguish it from the `HasTokens` method.
Configuration menu - View commit details
-
Copy full SHA for 14b859f - Browse repository at this point
Copy the full SHA 14b859fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 88373e9 - Browse repository at this point
Copy the full SHA 88373e9View commit details -
The only place it is meaningfully used is in a panic message in `TokenStream::from_ast`. But `node.span()` doesn't need to be printed because `node` is also printed and it must contain the span.
Configuration menu - View commit details
-
Copy full SHA for b261501 - Browse repository at this point
Copy the full SHA b261501View commit details -
Currently the second element is a `Vec<(FlatToken, Spacing)>`. But the vector always has zero or one elements, and the `FlatToken` is always `FlatToken::AttrTarget` (which contains an `AttributesData`), and the spacing is always `Alone`. So we can simplify it to `Option<AttributesData>`. An assertion in `to_attr_token_stream` can can also be removed, because `new_tokens.len()` was always 0 or 1, which means than `range.len()` is always greater than or equal to it, because `range.is_empty()` is always false (as per the earlier assertion).
Configuration menu - View commit details
-
Copy full SHA for 9d33a8f - Browse repository at this point
Copy the full SHA 9d33a8fView commit details -
Rename some attribute types for consistency.
- `AttributesData` -> `AttrsTarget` - `AttrTokenTree::Attributes` -> `AttrTokenTree::AttrsTarget` - `FlatToken::AttrTarget` -> `FlatToken::AttrsTarget`
Configuration menu - View commit details
-
Copy full SHA for 3a5c4b6 - Browse repository at this point
Copy the full SHA 3a5c4b6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 022582c - Browse repository at this point
Copy the full SHA 022582cView commit details -
`Option<LazyAttrTokenStream>` is the type that's actually used in all the aST nodes.
Configuration menu - View commit details
-
Copy full SHA for 9f16f1f - Browse repository at this point
Copy the full SHA 9f16f1fView commit details -
Use
filter_map
instead offlat_map
inconfigure_tokens
.All the branches produce either zero or one elements.
Configuration menu - View commit details
-
Copy full SHA for 9e0aab7 - Browse repository at this point
Copy the full SHA 9e0aab7View commit details
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.