clippy: Fix clone-on-copy warnings (#31877)

This commit is contained in:
Oluwatobi Sofela 2024-03-26 20:55:20 +01:00 committed by GitHub
parent 5f7baf31c2
commit b55d0a2053
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 41 additions and 47 deletions

View file

@ -116,7 +116,7 @@ impl Serializable for Blob {
_ => panic!("Unexpected variant of StructuredDataHolder"),
};
let blob_id = self.blob_id.clone();
let blob_id = self.blob_id;
// 1. Get a clone of the blob impl.
let blob_impl = self.global().serialize_blob(&blob_id);
@ -126,7 +126,7 @@ impl Serializable for Blob {
// 2. Store the object at a given key.
let blobs = blob_impls.get_or_insert_with(|| HashMap::new());
blobs.insert(new_blob_id.clone(), blob_impl);
blobs.insert(new_blob_id, blob_impl);
let PipelineNamespaceId(name_space) = new_blob_id.namespace_id;
let BlobIndex(index) = new_blob_id.index;
@ -152,10 +152,9 @@ impl Serializable for Blob {
) -> Result<(), ()> {
// 1. Re-build the key for the storage location
// of the serialized object.
let namespace_id = PipelineNamespaceId(storage_key.name_space.clone());
let index = BlobIndex(
NonZeroU32::new(storage_key.index.clone()).expect("Deserialized blob index is zero"),
);
let namespace_id = PipelineNamespaceId(storage_key.name_space);
let index =
BlobIndex(NonZeroU32::new(storage_key.index).expect("Deserialized blob index is zero"));
let id = BlobId {
namespace_id,
@ -245,7 +244,7 @@ impl BlobMethods for Blob {
let type_string =
normalize_type_string(&content_type.unwrap_or(DOMString::from("")).to_string());
let rel_pos = RelativePos::from_opts(start, end);
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id.clone(), type_string);
let blob_impl = BlobImpl::new_sliced(rel_pos, self.blob_id, type_string);
Blob::new(&self.global(), blob_impl)
}