Skip to content

Remove imports of enum variants in xml5ever/tokenizer/states.rs #651

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simonwuelker
Copy link
Contributor

states.rs has a really weird import pattern: The module defines a couple of different enums, mainly XmlState which defines tokenizer states, like XmlState::Data.
It then does pub(crate) use XmlState::*; and the rest of the crate uses either states::XmlState or states::Data to refer to either the enum or its variants respectively.

This is confusing, so this PR removes the wildcard imports.

tokenizer.rs still has some wildcard imports but those are really annoying to remove because the go! macro DSL of the state machine relies on them...

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker simonwuelker added the V-non-breaking A non-breaking change label Jul 27, 2025
use buffer_queue::{BufferQueue, FromSet, NotFromSet, SetResult};
use char_ref::{CharRef, CharRefTokenizer};
use qname::QualNameTokenizer;
use states::{AttrValueKind::*, DoctypeKind, DoctypeKind::*, XmlState};
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these wildcard imports meant to still be there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, these are slightly more difficult to remove.

Comment on lines -12 to -15
pub use AttrValueKind::*;
pub use DoctypeKind::*;
pub use XmlState::*;

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like it ought to be breaking, but https://docs.rs/xml5ever/latest/xml5ever/tokenizer/states/index.html doesn't show any types. So I assume these were not actually public even though they were pub used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks like it ought to be breaking, but https://docs.rs/xml5ever/latest/xml5ever/tokenizer/states/index.html doesn't show any types. So I assume these were not actually public even though they were pub used

No you're right, these are public. They're not shown on docs.rs because the enums in the latest published version are annotated with #[doc(hidden)]. My bad.

@simonwuelker simonwuelker added V-breaking Breaking change and removed V-non-breaking A non-breaking change labels Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-breaking Breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants