-
Notifications
You must be signed in to change notification settings - Fork 235
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
Don't import enum variants into the global namespace in html5ever #593
Conversation
7b0f4fd
to
9764e18
Compare
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
9764e18
to
3a6e62d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree! This makes the code a lot easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This is mostly the same as servo#593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This is mostly the same as #593 but for xml5ever. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
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::Foo
notation, renaming the variants where appropriate.This is a breaking change, because the
PushFlag
import was public (even though it really shouldn't have been, I suspect that's another common problem in html5ever).