Fixe some clippy warnings (#32131)

This commit is contained in:
komuhangi 2024-04-29 15:22:30 +03:00 committed by GitHub
parent d490fdf83c
commit 5a4c81f841
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 36 deletions

View file

@ -484,12 +484,11 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
if form_associated { if form_associated {
let _ac = JSAutoRealm::new(*cx, proto_object.get()); let _ac = JSAutoRealm::new(*cx, proto_object.get());
unsafe { unsafe {
match self.add_form_associated_callbacks(proto_object.handle(), &mut callbacks) { if let Err(error) =
Err(error) => { self.add_form_associated_callbacks(proto_object.handle(), &mut callbacks)
{
self.element_definition_is_running.set(false); self.element_definition_is_running.set(false);
return Err(error); return Err(error);
},
Ok(()) => {},
} }
} }
} }
@ -673,6 +672,7 @@ pub struct CustomElementDefinition {
} }
impl CustomElementDefinition { impl CustomElementDefinition {
#[allow(clippy::too_many_arguments)]
fn new( fn new(
name: LocalName, name: LocalName,
local_name: LocalName, local_name: LocalName,

View file

@ -743,8 +743,10 @@ impl Document {
.parent() .parent()
.and_then(|parent| parent.document()) .and_then(|parent| parent.document())
.map(|document| document.base_url()); .map(|document| document.base_url());
if document_url.as_str() == "about:srcdoc" && container_base_url.is_some() { if document_url.as_str() == "about:srcdoc" {
return container_base_url.unwrap(); if let Some(base_url) = container_base_url {
return base_url;
}
} }
// Step 2: If document's URL is about:blank, and document's browsing // Step 2: If document's URL is about:blank, and document's browsing
// context's creator base URL is non-null, then return that creator base URL. // context's creator base URL is non-null, then return that creator base URL.

View file

@ -1286,8 +1286,8 @@ impl GlobalScope {
// If the port is not enabled yet, or if is awaiting the completion of it's transfer, // If the port is not enabled yet, or if is awaiting the completion of it's transfer,
// the task will be buffered and dispatched upon enablement or completion of the transfer. // the task will be buffered and dispatched upon enablement or completion of the transfer.
if let Some(port_impl) = managed_port.port_impl.as_mut() { if let Some(port_impl) = managed_port.port_impl.as_mut() {
port_impl.handle_incoming(task).and_then(|to_dispatch| { port_impl.handle_incoming(task).map(|to_dispatch| {
Some((DomRoot::from_ref(&*managed_port.dom_port), to_dispatch)) (DomRoot::from_ref(&*managed_port.dom_port), to_dispatch)
}) })
} else { } else {
panic!("managed-port has no port-impl."); panic!("managed-port has no port-impl.");

View file

@ -61,8 +61,7 @@ impl Clone for HTMLCanvasElementOrOffscreenCanvas {
impl malloc_size_of::MallocSizeOf for GPUTextureDescriptor { impl malloc_size_of::MallocSizeOf for GPUTextureDescriptor {
fn size_of(&self, ops: &mut malloc_size_of::MallocSizeOfOps) -> usize { fn size_of(&self, ops: &mut malloc_size_of::MallocSizeOfOps) -> usize {
match self { let Self {
Self {
parent, parent,
dimension, dimension,
format, format,
@ -71,7 +70,7 @@ impl malloc_size_of::MallocSizeOf for GPUTextureDescriptor {
size, size,
usage, usage,
viewFormats, viewFormats,
} => { } = self;
parent.size_of(ops) + parent.size_of(ops) +
dimension.size_of(ops) + dimension.size_of(ops) +
format.size_of(ops) + format.size_of(ops) +
@ -80,8 +79,6 @@ impl malloc_size_of::MallocSizeOf for GPUTextureDescriptor {
size.size_of(ops) + size.size_of(ops) +
usage.size_of(ops) + usage.size_of(ops) +
viewFormats.size_of(ops) viewFormats.size_of(ops)
},
}
} }
} }

View file

@ -156,11 +156,8 @@ impl VirtualMethods for HTMLLabelElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() { if *attr.local_name() == local_name!("form") {
local_name!("form") => {
self.form_attribute_mutated(mutation); self.form_attribute_mutated(mutation);
},
_ => {},
} }
} }
} }