-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement iter()
, len()
and is_empty()
for all display-literal AST nodes
#12807
Conversation
CodSpeed Performance ReportMerging #12807 will not alter performanceComparing Summary
|
|
If it makes sense, we could just implement |
Yeah, it's an interesting idea. I'm not sure if methods like I considered creating a |
93e5ea6
to
23b601e
Compare
Summary
This PR adds
iter()
,len()
andis_empty()
methods to all the AST nodes representing "display literals":ExprList
ExprSet
ExprTuple
ExprDict
Each of these nodes wraps an inner
Vec
of elements; it's rare to use these nodes in linter rules without either iterating over the elements or querying the number of elements. Exposing these methods on the outer nodes makes a lot of our code simpler and more elegant.Test Plan
cargo test