Cleanup warnings

This commit is contained in:
Cameron
2025-07-17 20:08:12 -04:00
parent e5afdd909b
commit 264195d3a2
3 changed files with 14 additions and 19 deletions

View File

@@ -299,7 +299,7 @@ impl TagDao for SqliteTagDao {
) -> anyhow::Result<Vec<(i64, Tag)>> {
// select name, count(*) from tags join tagged_photo ON tags.id = tagged_photo.tag_id GROUP BY tags.name ORDER BY COUNT(*);
trace_db_call(&context, "query", "get_all_tags", |span| {
trace_db_call(context, "query", "get_all_tags", |span| {
span.set_attribute(KeyValue::new("path", path.clone().unwrap_or_default()));
let path = path.map(|p| p + "%").unwrap_or("%".to_string());
@@ -334,7 +334,7 @@ impl TagDao for SqliteTagDao {
context: &opentelemetry::Context,
path: &str,
) -> anyhow::Result<Vec<Tag>> {
trace_db_call(&context, "query", "get_tags_for_path", |span| {
trace_db_call(context, "query", "get_tags_for_path", |span| {
span.set_attribute(KeyValue::new("path", path.to_string()));
debug!("Getting Tags for path: {:?}", path);
@@ -348,7 +348,7 @@ impl TagDao for SqliteTagDao {
}
fn create_tag(&mut self, context: &opentelemetry::Context, name: &str) -> anyhow::Result<Tag> {
trace_db_call(&context, "insert", "create_tag", |span| {
trace_db_call(context, "insert", "create_tag", |span| {
span.set_attribute(KeyValue::new("name", name.to_string()));
diesel::insert_into(tags::table)
@@ -386,7 +386,7 @@ impl TagDao for SqliteTagDao {
tag_name: &str,
path: &str,
) -> anyhow::Result<Option<()>> {
trace_db_call(&context, "delete", "remove_tag", |span| {
trace_db_call(context, "delete", "remove_tag", |span| {
span.set_attributes(vec![
KeyValue::new("tag_name", tag_name.to_string()),
KeyValue::new("path", path.to_string()),
@@ -421,7 +421,7 @@ impl TagDao for SqliteTagDao {
path: &str,
tag_id: i32,
) -> anyhow::Result<TaggedPhoto> {
trace_db_call(&context, "insert", "tag_file", |span| {
trace_db_call(context, "insert", "tag_file", |span| {
span.set_attributes(vec![
KeyValue::new("path", path.to_string()),
KeyValue::new("tag_id", tag_id.to_string()),
@@ -464,7 +464,7 @@ impl TagDao for SqliteTagDao {
exclude_tag_ids: Vec<i32>,
context: &opentelemetry::Context,
) -> anyhow::Result<Vec<FileWithTagCount>> {
trace_db_call(&context, "query", "get_files_with_all_tags", |_| {
trace_db_call(context, "query", "get_files_with_all_tags", |_| {
use diesel::dsl::*;
let exclude_subquery = tagged_photo::table
@@ -501,7 +501,7 @@ impl TagDao for SqliteTagDao {
exclude_tag_ids: Vec<i32>,
context: &opentelemetry::Context,
) -> anyhow::Result<Vec<FileWithTagCount>> {
trace_db_call(&context, "query", "get_files_with_any_tags", |_| {
trace_db_call(context, "query", "get_files_with_any_tags", |_| {
use diesel::dsl::*;
// Create the placeholders for the IN clauses
let tag_placeholders = std::iter::repeat("?")

View File

@@ -1,9 +1,6 @@
use futures::future::{Inspect, MapOk};
use futures::task::SpawnExt;
use futures::{FutureExt, TryFutureExt};
use log::{debug, error, info, trace, warn};
use std::future::Future;
use std::io::{Result, Stdout};
use futures::TryFutureExt;
use log::{debug, error, info, warn};
use std::io::{Result};
use std::process::{Output, Stdio};
use std::time::Instant;
use tokio::process::Command;

View File

@@ -16,7 +16,7 @@ pub async fn generate_video_gifs() {
let start = std::time::Instant::now();
let tracer = global_tracer();
let span = tracer.start("creating video gifs");
tracer.start("creating video gifs");
let gif_base_path = &dotenv::var("GIFS_DIRECTORY").unwrap_or(String::from("gifs"));
let gif_directory: &Path = Path::new(gif_base_path);
@@ -29,7 +29,7 @@ pub async fn generate_video_gifs() {
.into_iter()
.filter_map(|entry| entry.ok())
.filter(|entry| entry.file_type().is_file())
.filter(|entry| is_video(entry))
.filter(is_video)
.filter(|entry| {
let path = entry.path();
let relative_path = &path.strip_prefix(&files).unwrap();
@@ -43,10 +43,8 @@ pub async fn generate_video_gifs() {
let gif_path = Path::new(gif_directory).join(relative_path);
let gif_path = gif_path.with_extension("gif");
if let Some(parent_dir) = gif_path.parent() {
fs::create_dir_all(parent_dir).expect(&format!(
"There was an issue creating gif directory {:?}",
gif_path
));
fs::create_dir_all(parent_dir).unwrap_or_else(|_| panic!("There was an issue creating gif directory {:?}",
gif_path));
}
info!("Generating gif for {:?}", path);