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

Make keyword and builtin sets static #554

Merged

Conversation

NoahTheDuke
Copy link
Member

@NoahTheDuke NoahTheDuke commented Oct 20, 2021

No need to initialize the keyword and builtin sets inline and then pass them around manually. Instead, define them as static (using the lazy_static library once_cell library) and reference them "globally".

@NoahTheDuke NoahTheDuke force-pushed the nb/lazy-static-keywords-validation branch from 05247d3 to 20fba3f Compare October 20, 2021 15:45
Copy link
Contributor

@CAD97 CAD97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm positive on this change, but I'd prefer to use once_cell::Lazy to lazy_static.

@NoahTheDuke
Copy link
Member Author

Sure! Never heard of that one but looks relatively similar so switching over should be easy enough.

Noah Bogart added 2 commits October 20, 2021 23:04
No need to initialize the keyword and builtin sets inline and then pass them
around manually. Instead, define them as static (using the lazy_static library)
and reference them "globally".
@NoahTheDuke NoahTheDuke force-pushed the nb/lazy-static-keywords-validation branch from 20fba3f to 26156a4 Compare October 21, 2021 03:28
@CAD97
Copy link
Contributor

CAD97 commented Jul 19, 2022

(it'd be interesting to make these maps a static phf map instead, but future work.)

I'd be happy to merge this with lints fixed.

@NoahTheDuke
Copy link
Member Author

The change to once-cell was to align with std, right? I think it's now called SyncLazy, but it's still on nightly.

@CAD97
Copy link
Contributor

CAD97 commented Jul 19, 2022

Pretty much yeah, the once-cell API is on track to be std-available eventually.

meta/src/validator.rs Outdated Show resolved Hide resolved
@CAD97
Copy link
Contributor

CAD97 commented Jul 19, 2022

Merging #555 led to a merge conflict; r=me after that's fixed

@CAD97 CAD97 enabled auto-merge July 19, 2022 18:35
auto-merge was automatically disabled July 19, 2022 18:41

Head branch was pushed to by a user without write access

I am frustrated that this doesn't show up locally
@NoahTheDuke
Copy link
Member Author

For some reason, running clippy locally doesn't show these errors so I think it's okay to remove the clippy::ptr_arg directives.

@NoahTheDuke
Copy link
Member Author

Okay, figured it out. These warnings don't happen in the latest version of Rust + Clippy, but Pest uses 1.56.1, from last October. If this is something worth updating, I can do that.

@CAD97
Copy link
Contributor

CAD97 commented Jul 19, 2022

I bet I know what it is: the CI clippy is avoid-breaking-exported-api = false (predates that) but modern clippy won't suggest changing public API.

We definitely could use some restructuring of our CI pipeline to separate the MSRV checks from the clippy/fmt checks. See also #655.

@CAD97 CAD97 merged commit f581cd8 into pest-parser:master Jul 19, 2022
@NoahTheDuke NoahTheDuke deleted the nb/lazy-static-keywords-validation branch July 19, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants