Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix Clippy performance lints

Manav Rathid06ac2dd93b7
diff --git a/rust/apps/cli/src/live_photo.rs b/rust/apps/cli/src/live_photo.rs
index 666ddbeca2..113325a934 100644
--- a/rust/apps/cli/src/live_photo.rs
+++ b/rust/apps/cli/src/live_photo.rs
@@ -61,11 +61,11 @@ pub(crate) async fn extract_live_photo(zip_data: &[u8], output_path: &Path) -> R
.and_then(|name| name.to_str())
.ok_or_else(|| Error::Generic("Invalid filename".into()))?;
let mut expanded = 0;
+ let mut buffer = vec![0; 64 * 1024];
for entry in [image, video] {
let mut input = archive.by_index(entry.index)?;
let path = parent.join(format!("{base}.{}", entry.extension));
let mut output = fs::File::create(&path).await?;
- let mut buffer = [0; 64 * 1024];
loop {
let count = input.read(&mut buffer)?;
if count == 0 {
diff --git a/rust/bindings/wasm/space/src/space.rs b/rust/bindings/wasm/space/src/space.rs
index 07353a7b09..7d63c5c71c 100644
--- a/rust/bindings/wasm/space/src/space.rs
+++ b/rust/bindings/wasm/space/src/space.rs
@@ -532,13 +532,13 @@ pub async fn space_open_account_ctx(
let input: OpenAccountSpaceCtxJsInput = swb::from_value(input)?;
let space_root_key = decode_b64_field(&input.space_root_key_b64)?;
let ctx = AccountSpaceCtx::open(OpenAccountSpaceCtxInput {
- base_url: input.base_url.clone(),
+ base_url: input.base_url,
space_session_token: input.space_session_token,
space_root_key,
initial_owned_spaces: input.owned_spaces,
- user_agent: input.user_agent.clone(),
- client_package: input.client_package.clone(),
- client_version: input.client_version.clone(),
+ user_agent: input.user_agent,
+ client_package: input.client_package,
+ client_version: input.client_version,
})?;
Ok(SpaceAccountCtxHandle { inner: ctx })
}
diff --git a/rust/crates/assets/src/archive.rs b/rust/crates/assets/src/archive.rs
index 261c66ac40..429969b46f 100644
--- a/rust/crates/assets/src/archive.rs
+++ b/rust/crates/assets/src/archive.rs
@@ -20,6 +20,7 @@ pub(crate) fn extract_tar_gz(
let tar_gz = File::open(archive_path)?;
let mut archive = Archive::new(GzDecoder::new(tar_gz));
+ let mut buffer = vec![0; 1024 * 1024];
for entry in archive.entries()? {
if cancellation.is_cancelled() {
return Err(Error::Cancelled);
@@ -51,7 +52,6 @@ pub(crate) fn extract_tar_gz(
fs::create_dir_all(parent)?;
}
let mut output = File::create(destination)?;
- let mut buffer = [0; 1024 * 1024];
loop {
if cancellation.is_cancelled() {
return Err(Error::Cancelled);
diff --git a/rust/crates/space/src/client/mod.rs b/rust/crates/space/src/client/mod.rs
index 7174d2fe84..7dc13fc670 100644
--- a/rust/crates/space/src/client/mod.rs
+++ b/rust/crates/space/src/client/mod.rs
@@ -212,7 +212,7 @@ impl AccountSpaceCtx {
})?;
let identity = self.decrypt_space_identity(&space)?;
cache_lock(&self.space_identity_cache, "space identity")?
- .insert(space.space_id.clone(), identity.clone());
+ .insert(space.space_id, identity.clone());
Ok(identity)
}