a few more clippylints

This commit is contained in:
Brandon Thomas committed 2024-01-24 23:16:36 -05:00
1 parent 0743684f0d
commit d80b883ce7
7 files changed
+15 -10

No files matched your search

+4
View File
@@ -18,6 +18,9 @@ deny = [
"clippy::borrow_as_ptr",
"clippy::borrow_deref_ref",
# Clippy async
"clippy::await_holding_lock",
# Clippy - performance
"clippy::cmp_owned",
"clippy::useless_vec",
@@ -48,6 +51,7 @@ deny = [
# Possible:
# "clippy::ptr_arg",
# "clippy::too_many_lines" (note: this is configurable)
# "clippy::clone_on_copy", # Don't use clone() on Copy types
]
warn = [
@@ -1,4 +1,5 @@
use anyhow::anyhow;
use errors::AnyhowResult;
use filesys::file_read_bytes::file_read_bytes;
use filesys::file_size::file_size;
@@ -12,7 +13,6 @@ use crate::remote_file_manager::remote_cloud_bucket_details::RemoteCloudBucketDe
use super::file_descriptor::FileDescriptor;
use super::file_meta_data::FileMetaData;
pub struct RemoteCloudFileClient {
bucket_orchestration_client: Box<dyn BucketOrchestrationCore>
}
@@ -43,7 +43,7 @@ impl RemoteCloudFileClient {
let file_descriptor = remote_cloud_bucket_details.file_descriptor_from_bucket_details();
let file_bucket_directory = FileBucketDirectory::from_existing_bucket_details(remote_cloud_bucket_details);
let full_remote_cloud_file_path = file_bucket_directory.get_full_remote_cloud_file_path().to_string();
let is_public = file_descriptor.is_public().clone();
let is_public = file_descriptor.is_public();
self.bucket_orchestration_client.download_file_to_disk(full_remote_cloud_file_path, to_system_file_path, is_public).await?;
Ok(())
@@ -105,6 +105,7 @@ impl RemoteCloudFileClient {
mod tests {
use async_trait::async_trait;
use env_logger;
use errors::AnyhowResult;
use crate::remote_file_manager::bucket_orchestration::BucketOrchestrationCore;
@@ -30,7 +30,7 @@ impl TtlKeyCounter {
Ok(0)
}
Some(count) => {
let return_count = count.clone();
let return_count = *count;
*count = count.saturating_add(1);
Ok(return_count)
}
@@ -221,7 +221,7 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
maybe_media_file_public_bucket_prefix: record.maybe_media_file_public_bucket_prefix.clone(),
maybe_media_file_public_bucket_extension: record.maybe_media_file_public_bucket_extension.clone(),
public_bucket_location_is_hash: bucket_path_is_hash,
maybe_successfully_completed_at: record.maybe_successfully_completed_at.clone(),
maybe_successfully_completed_at: record.maybe_successfully_completed_at,
}
})
})
@@ -64,7 +64,7 @@ pub async fn insert_tts_result<P: AsRef<Path>>(
maybe_creator_user_token = tts_job.maybe_creator_user_token.clone();
tts_model_token = tts_job.model_token.clone();
creator_ip_address = tts_job.creator_ip_address.clone();
creator_set_visibility = tts_job.creator_set_visibility.clone();
creator_set_visibility = tts_job.creator_set_visibility;
}
JobType::GenericInferenceJob(generic_job) => {
raw_inference_text = generic_job.maybe_raw_inference_text.as_deref()
@@ -75,7 +75,7 @@ pub async fn insert_tts_result<P: AsRef<Path>>(
.unwrap_or("")
.to_string();
creator_ip_address = generic_job.creator_ip_address.clone();
creator_set_visibility = generic_job.creator_set_visibility.clone();
creator_set_visibility = generic_job.creator_set_visibility;
}
}
@@ -154,7 +154,7 @@ impl ListW2lResultsQueryBuilder {
maybe_creator_user_token: r.maybe_creator_user_token.clone(),
maybe_creator_username: r.maybe_creator_username.clone(),
maybe_creator_display_name: r.maybe_creator_display_name.clone(),
maybe_creator_result_id: r.maybe_creator_result_id.map(|v| v as u64).clone(),
maybe_creator_result_id: r.maybe_creator_result_id.map(|v| v as u64),
file_size_bytes: if r.file_size_bytes > 0 { r.file_size_bytes as u32 } else { 0 },
frame_width: if r.frame_width > 0 { r.frame_width as u32 } else { 0 },
frame_height: if r.frame_height > 0 { r.frame_height as u32 } else { 0 },
@@ -93,7 +93,7 @@ impl TextPipelineType {
TextPipelineType::SpanishV2 => TextPipelineType::LegacyFakeYou,
TextPipelineType::SyntheticLegacyFakeYou2 => TextPipelineType::LegacyFakeYou,
// Maintain original type for everything else
_ => self.clone(),
_ => *self,
}
}
@@ -105,7 +105,7 @@ impl TextPipelineType {
// with the mysterious "legacy_fakeyou_2".
TextPipelineType::SpanishV2 => TextPipelineType::SyntheticLegacyFakeYou2,
// Maintain original type for everything else
_ => self.clone(),
_ => *self,
}
}
@@ -116,7 +116,7 @@ impl TextPipelineType {
// and it should never be saved to the DB.
TextPipelineType::SyntheticLegacyFakeYou2 => TextPipelineType::SpanishV2,
// Maintain original type for everything else
_ => self.clone(),
_ => *self,
}
}
}