Removed old packages, fixed clippy warnings

This commit is contained in:
torbjornmolin
2025-09-28 18:59:06 +02:00
parent eb4a06b669
commit 6efc9e104c
3 changed files with 3 additions and 10 deletions

2
Cargo.lock generated
View File

@@ -806,12 +806,10 @@ name = "image-placeholder-generator"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"axum", "axum",
"bytes",
"image", "image",
"serde", "serde",
"text-to-png", "text-to-png",
"tokio", "tokio",
"tokio-util",
"tower-http", "tower-http",
"tracing-subscriber", "tracing-subscriber",
"zip", "zip",

View File

@@ -5,12 +5,10 @@ edition = "2024"
[dependencies] [dependencies]
axum = "0.8.4" axum = "0.8.4"
bytes = "1"
image = "0.25.8" image = "0.25.8"
serde = { version = "1.0.227", features = ["derive"] } serde = { version = "1.0.227", features = ["derive"] }
text-to-png = "0.2.0" text-to-png = "0.2.0"
tokio = { version = "1.47.1", features = ["fs", "rt-multi-thread"] } tokio = { version = "1.47.1", features = ["fs", "rt-multi-thread"] }
tokio-util = { version = "0.7.16", features = ["io"] }
tower-http = { version = "0.6.6", features = ["fs", "trace"] } tower-http = { version = "0.6.6", features = ["fs", "trace"] }
tracing-subscriber = "0.3.20" tracing-subscriber = "0.3.20"
zip = "5.1.1" zip = "5.1.1"

View File

@@ -4,7 +4,7 @@ use axum::{
http::{Response, StatusCode, header}, http::{Response, StatusCode, header},
routing::post, routing::post,
}; };
use image::{GenericImage, GenericImageView}; use image::GenericImage;
use serde::Deserialize; use serde::Deserialize;
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use tower_http::services::ServeFile; use tower_http::services::ServeFile;
@@ -78,7 +78,7 @@ fn get_files(options: GenerateOptions) -> Vec<(String, Vec<u8>)> {
for f in options.filenames { for f in options.filenames {
let mut imgbuf = image::ImageBuffer::new(options.width, options.height); let mut imgbuf = image::ImageBuffer::new(options.width, options.height);
for (x, y, pixel) in imgbuf.enumerate_pixels_mut() { for (_x, _y, pixel) in imgbuf.enumerate_pixels_mut() {
*pixel = image::Rgba([190, 190, 190, 255]); *pixel = image::Rgba([190, 190, 190, 255]);
} }
@@ -103,10 +103,7 @@ fn get_files(options: GenerateOptions) -> Vec<(String, Vec<u8>)> {
let mut buf = Cursor::new(Vec::new()); let mut buf = Cursor::new(Vec::new());
imgbuf.write_to(&mut buf, image::ImageFormat::Png).unwrap(); imgbuf.write_to(&mut buf, image::ImageFormat::Png).unwrap();
files.push(( files.push((format!("{}.{}", f, image_file_ending), buf.into_inner()));
String::from(format!("{}.{}", f, image_file_ending)),
buf.into_inner(),
));
} }
files files