clippy: Fix a few clippy problems in components/scripts/dom (#31905)

* option_as_ref_deref

* fix
This commit is contained in:
Rosemary Ajayi 2024-03-28 12:24:39 +01:00 committed by GitHub
parent 1bc63801e7
commit 5aae820f6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 12 deletions

View file

@ -80,7 +80,7 @@ impl Blob {
},
};
let type_string = normalize_type_string(&blobPropertyBag.type_.to_string());
let type_string = normalize_type_string(blobPropertyBag.type_.as_ref());
let blob_impl = BlobImpl::new_from_bytes(bytes, type_string);
Ok(Blob::new_with_proto(global, proto, blob_impl))
@ -125,7 +125,7 @@ impl Serializable for Blob {
let new_blob_id = blob_impl.blob_id();
// 2. Store the object at a given key.
let blobs = blob_impls.get_or_insert_with(|| HashMap::new());
let blobs = blob_impls.get_or_insert_with(HashMap::new);
blobs.insert(new_blob_id, blob_impl);
let PipelineNamespaceId(name_space) = new_blob_id.namespace_id;
@ -242,7 +242,7 @@ impl BlobMethods for Blob {
content_type: Option<DOMString>,
) -> DomRoot<Blob> {
let type_string =
normalize_type_string(&content_type.unwrap_or(DOMString::from("")).to_string());
normalize_type_string(content_type.unwrap_or(DOMString::from("")).as_ref());
let rel_pos = RelativePos::from_opts(start, end);
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id, type_string);
Blob::new(&self.global(), blob_impl)