Don't import enum variants into the global namespace in html5ever#593
Merged
simonwuelker merged 1 commit intoservo:mainfrom Apr 6, 2025
Merged
Don't import enum variants into the global namespace in html5ever#593simonwuelker merged 1 commit intoservo:mainfrom
simonwuelker merged 1 commit intoservo:mainfrom
Conversation
7b0f4fd to
9764e18
Compare
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
9764e18 to
3a6e62d
Compare
mrobinson
approved these changes
Apr 6, 2025
Member
mrobinson
left a comment
There was a problem hiding this comment.
I totally agree! This makes the code a lot easier to follow.
nicoburns
approved these changes
Apr 6, 2025
Contributor
nicoburns
left a comment
There was a problem hiding this comment.
This does make the code a bit more verbose, but overall this seems like a really good change. Definitely makes the code more readable to me knowing which enum the type is coming from.
simonwuelker
added a commit
to simonwuelker/html5ever
that referenced
this pull request
Apr 12, 2025
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
simonwuelker
added a commit
to simonwuelker/html5ever
that referenced
this pull request
Apr 12, 2025
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
simonwuelker
added a commit
to simonwuelker/html5ever
that referenced
this pull request
Apr 12, 2025
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
simonwuelker
added a commit
to simonwuelker/html5ever
that referenced
this pull request
Apr 12, 2025
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 12, 2025
This is mostly the same as #593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This was referenced Jun 20, 2025
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.
Currently the tokenizer and treebuilder in html5ever import all variants of commonly used enums:
This is not really idiomatic rust. I've never seen any other codebase do this, and it is not the style we use in servo either.
This change removes the imports and instead uses the
Token::Foonotation, renaming the variants where appropriate.This is a breaking change, because the
PushFlagimport was public (even though it really shouldn't have been, I suspect that's another common problem in html5ever).