fix: simple clippy recommendations

This commit is contained in:
2025-07-10 16:57:12 -05:00
parent 3bf37b936f
commit 94e5fccc40
2 changed files with 9 additions and 11 deletions

View File

@@ -17,13 +17,14 @@ mod template;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
// Parse dotenv files and expose them as environment variables // Development-only: Parse dotenv files and expose them as environment variables
#[cfg(debug_assertions)]
dotenv().ok(); dotenv().ok();
// envy uses our Configuration struct to parse environment variables // Envy uses our Configuration struct to parse environment variables
let config = envy::from_env::<Configuration>().expect("Please provide PORT env var"); let config = envy::from_env::<Configuration>().expect("Failed to parse environment variables");
// initialize tracing // Initialize tracing
tracing_subscriber::fmt() tracing_subscriber::fmt()
// With the log_level from our config // With the log_level from our config
.with_max_level(config.log_level()) .with_max_level(config.log_level())

View File

@@ -1,13 +1,10 @@
use crate::error::{get_error_response, TimeBannerError}; use crate::error::{get_error_response, TimeBannerError};
use axum::body::{Body, Bytes}; use axum::body::Bytes;
use axum::extract::Path; use axum::extract::Path;
use axum::http::header; use axum::response::{IntoResponse, Redirect};
use axum::response::{Redirect, Response}; use chrono::{DateTime, Utc};
use axum::{http::StatusCode, response::IntoResponse};
use chrono::{DateTime, NaiveDateTime, Offset, Utc};
use crate::raster::Rasterizer; use crate::raster::Rasterizer;
use crate::template::{render_template, OutputForm, RenderContext};
pub fn split_on_extension(path: &str) -> Option<(&str, &str)> { pub fn split_on_extension(path: &str) -> Option<(&str, &str)> {
let split = path.rsplit_once('.')?; let split = path.rsplit_once('.')?;
@@ -21,7 +18,7 @@ pub fn split_on_extension(path: &str) -> Option<(&str, &str)> {
} }
fn parse_path(path: &str) -> (&str, &str) { fn parse_path(path: &str) -> (&str, &str) {
split_on_extension(path).or(Some((path, "svg"))).unwrap() split_on_extension(path).unwrap_or((path, "svg"))
} }
fn handle_rasterize(data: String, extension: &str) -> Result<(&str, Bytes), TimeBannerError> { fn handle_rasterize(data: String, extension: &str) -> Result<(&str, Bytes), TimeBannerError> {