clippy: Fix many warnings in components/script (#31717)

* Fix Several clippy warnings

* Fix Build errors

* Fix Unused import

* Fix requested changes

* Fix rustfmt

* Minor fixes

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Richard Dushime 2024-03-19 19:05:56 +03:00 committed by GitHub
parent 676f655647
commit 01ca220f83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 200 additions and 212 deletions

View file

@ -78,10 +78,10 @@ impl ShadowRoot {
}
pub fn detach(&self) {
self.document.unregister_shadow_root(&self);
self.document.unregister_shadow_root(self);
let node = self.upcast::<Node>();
node.set_containing_shadow_root(None);
Node::complete_remove_subtree(&node, &UnbindContext::new(node, None, None, None));
Node::complete_remove_subtree(node, &UnbindContext::new(node, None, None, None));
self.host.set(None);
}
@ -188,9 +188,7 @@ impl ShadowRootMethods for ShadowRoot {
) {
Some(e) => {
let retargeted_node = self.upcast::<Node>().retarget(e.upcast::<Node>());
retargeted_node
.downcast::<Element>()
.map(|n| DomRoot::from_ref(n))
retargeted_node.downcast::<Element>().map(DomRoot::from_ref)
},
None => None,
}
@ -207,10 +205,7 @@ impl ShadowRootMethods for ShadowRoot {
.iter()
{
let retargeted_node = self.upcast::<Node>().retarget(e.upcast::<Node>());
if let Some(element) = retargeted_node
.downcast::<Element>()
.map(|n| DomRoot::from_ref(n))
{
if let Some(element) = retargeted_node.downcast::<Element>().map(DomRoot::from_ref) {
elements.push(element);
}
}