servo / html5ever

High-performance browser-grade HTML5 parser
Other
2.14k stars 222 forks source link

Don't ignore warnings in `html5ever/src/tree_builder` #551

Closed simonwuelker closed 2 months ago

simonwuelker commented 2 months ago

Currently, html5ever/src/tree_builder/mod.rs contains this: https://github.com/servo/html5ever/blob/e6f0018d50b358240392a44851972b66c69deeb5/html5ever/src/tree_builder/mod.rs#L10

Presumably, this is done to ignore all the warnings caused by the rules.rs file generated at build time (Which is simply included in mod.rs).

However, this masks many warnings from the actual code itself. This PR instead puts the generated code into its own module, ignores warnings only for this specific module and then fixes (almost) all the warnings in the rest of the code.

#[allow(warnings)]
mod autogenerated {
    include!(concat!(env!("OUT_DIR"), "/rules.rs"));
}

There are two warnings that are not fixed by this PR:

I've made individual commits for each "kind" of lint being addressed - I can squash these together if preferred.