rust lint: unused mut

This commit is contained in:
Brandon Thomas committed 2024-01-20 18:40:15 -05:00
1 parent 7558a4edc9
commit f812fbb4e6
13 files changed
+27 -29

No files matched your search

+1 -2
View File
@@ -43,8 +43,7 @@ deny = [
"unused_imports", # These are easy to automatically cull
"unused_parens", # Unused parens are ugly
"unused_variables", # Don't leave cruft
#"unused_mut", # Be strict about mutability (TODO)
"unused_mut", # Be strict about mutability
# Possible:
# "clippy::ptr_arg",
@@ -146,22 +146,22 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool<MySql>, user_token: UserT
_ => WeightsType::LoRA
};
let mut model_weight_token;
let mut title;
let mut description;
let mut description_rendered_html;
let mut original_filename;
let mut original_download_url;
let model_weight_token;
let title;
let description;
let description_rendered_html;
let original_filename;
let original_download_url;
let mut _private_bucket_hash:String = "".to_string();
let mut private_bucket_prefix;
let mut private_bucket_extension;
let _private_bucket_hash = "".to_string();
let private_bucket_prefix;
let private_bucket_extension;
//let mut cached_user_ratings_total_count;
//let mut cached_user_ratings_positive_count;
//let mut cached_user_ratings_negative_count;
//let mut cached_user_ratings_ratio;
let mut version;
let version;
match i {
1..=20 => {
+4 -4
View File
@@ -64,10 +64,10 @@ pub async fn main() -> AnyhowResult<()> {
let bytes = file_read_bytes(args.file_path)?;
let mimetype = get_mimetype_for_bytes(&bytes);
let mut media_file_type;
let mut maybe_mime_type;
let mut maybe_public_bucket_prefix;
let mut maybe_public_bucket_extension;
let media_file_type;
let maybe_mime_type;
let maybe_public_bucket_prefix;
let maybe_public_bucket_extension;
match mimetype {
Some("audio/wav") |
+1 -1
View File
@@ -37,7 +37,7 @@ impl JobStats {
pub fn get_status(&self) -> AnyhowResult<SuccessAndFailureStats> {
// NB: lock errors can't be moved between threads, so we change their type
let mut lock = self.inner.read()
let lock = self.inner.read()
.map_err(|e| anyhow!("lock read error: {:?}", e))?;
Ok(SuccessAndFailureStats {
@@ -48,7 +48,7 @@ pub async fn upsert_model_weights_record(
record: &WholeTtsModelRecord,
model_weight_token: &ModelWeightToken,
copied_data: &CopiedTtsFileData,
mut transaction: &mut Transaction<'_, MySql>,
transaction: &mut Transaction<'_, MySql>,
) -> AnyhowResult<()> {
// NB: We never supported other TTS models in the tts_models table.
@@ -50,7 +50,7 @@ pub async fn upsert_model_weights_record(
record: &WholeVoiceConversionModelRecord,
model_weight_token: &ModelWeightToken,
copied_data: &CopiedFileData,
mut transaction: &mut Transaction<'_, MySql>,
transaction: &mut Transaction<'_, MySql>,
) -> AnyhowResult<()> {
let weights_type = match record.model_type {
@@ -28,7 +28,7 @@ pub async fn gizmodo_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
}
};
let mut maybe_skip_reason = None;
let maybe_skip_reason = None;
//// Lazy heuristic to skip CNN video articles, which contain little text.
//// eg. https://www.cnn.com/videos/politics/2023/02/08/pelosi-gop-hecklers-reaction-joe-biden-state-of-the-union-tapper-intv-vpx.cnn
@@ -28,7 +28,7 @@ pub async fn kotaku_indexer() -> AnyhowResult<Vec<WebScrapingTarget>> {
}
};
let mut maybe_skip_reason = None;
let maybe_skip_reason = None;
//// Lazy heuristic to skip CNN video articles, which contain little text.
//// eg. https://www.cnn.com/videos/politics/2023/02/08/pelosi-gop-hecklers-reaction-joe-biden-state-of-the-union-tapper-intv-vpx.cnn
@@ -141,11 +141,10 @@ pub async fn process_job_inference(
// thread::sleep(seconds) to check the directory
//NB: TempDir exists until it goes out of scope, at which point it should delete from filesystem.
let mut work_temp_dir = args.job_dependencies.fs.scoped_temp_dir_creator_for_work
let work_temp_dir = args.job_dependencies.fs.scoped_temp_dir_creator_for_work
.new_tempdir(&work_temp_dir)
.map_err(|e| ProcessSingleJobError::from_io_error(e))?;
let sd_checkpoint_path = work_temp_dir.path().join("sd_checkpoint.safetensors");
let lora_path = work_temp_dir.path().join("lora.safetensors");
let vae_path = work_temp_dir.path().join("vae.safetensors");
@@ -86,8 +86,8 @@ pub fn validate_job(job: &AvailableInferenceJob) -> Result<JobArgs, ProcessSingl
Some(FaceEnhancer::R) => Some("RestoreFormer".to_string()),
};
let mut width = inference_args.maybe_resize_width;
let mut height = inference_args.maybe_resize_height;
let width = inference_args.maybe_resize_width;
let height = inference_args.maybe_resize_height;
Ok(JobArgs {
audio_source,
@@ -87,7 +87,7 @@ pub async fn process_job(args: RerenderProcessJobArgs<'_>) -> Result<JobSuccessR
// ==================== TRANSCODE MEDIA (IF NECESSARY) ==================== //
let mut usable_video_path = video_path.filesystem_path.clone();
let usable_video_path = video_path.filesystem_path.clone();
//TODO: re encode with ffmpeg
@@ -166,7 +166,7 @@ impl FfmpegLogoWatermarkCommand {
&command
];
let mut config = PopenConfig::default();
let config = PopenConfig::default();
let mut p = Popen::create(&command_parts, config)?;
+2 -2
View File
@@ -37,7 +37,7 @@ async fn main() -> AnyhowResult<()> {
// I'm too tired to figure out the generic types though.
if env_args.enable_gzip {
HttpServer::new(move || {
let mut app = App::new()
let app = App::new()
.wrap(Logger::new(&log_format))
.wrap(DefaultHeaders::new()
.header("X-Backend-Hostname", &server_hostname))
@@ -55,7 +55,7 @@ async fn main() -> AnyhowResult<()> {
.await?;
} else {
HttpServer::new(move || {
let mut app = App::new()
let app = App::new()
.wrap(Logger::new(&log_format))
.wrap(DefaultHeaders::new()
.header("X-Backend-Hostname", &server_hostname));