Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd lint check for `&Dom<` and `&DomRoot<` #25342
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
@highfive: assign me |
|
Hey @lberrymage! Thanks for your interest in working on this issue. It's now assigned to you! |
|
After making the change, I expect |
|
Good to know, thanks. Would it be best to correct those uses first to ensure each commit passes tests individually? |
|
Putting them in the same commit would be nice, but it also isn't a hard requirement. |
Add &DomRoot<T> lint check So far, the lint check code appears to work as intended. However, some trait implementations require modification to pass the lint check and I'm not sure how to fix these. Commit 92cf5d5 attempts to correct one of the implementations, but fails to compile with error: ``` --> components/script/dom/servoparser/xml.rs:76:36 | 76 | tree_builder.trace_handles(&tracer); | ^^^^^^^ expected struct `dom::bindings::root::Dom`, found struct `dom::node::Node` | = note: expected struct `dom::bindings::root::Dom<dom::node::Node>` found struct `dom::node::Node` = note: required for the cast to the object type `dyn html5ever::tree_builder::Tracer<Handle = dom::bindings::root::Dom<dom::node::Node>>` ``` I've tried to debug further but to no avail. I also don't want to mangle too much existing code unnecessarily. Any help is appreciated. <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors `./mach test-tidy --all` does, and some are directly related to this PR - [ ] These changes fix #25342 The fix is a WIP <!-- Either: --> - [X] There are tests for these changes Note that I will clean up the commit history before the final PR. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
&Dom<T>and&DomRoot<T>are strictly less expressive than&T, so there's no reason to use them.Code:
servo/python/tidy/servo_tidy/tidy.py
Lines 624 to 625 in aa36d5f