Server overhaul: clear clippy::pedantic wins

Taken from a -W clippy::pedantic scan, no allow added: map_or/map_or_else, method references instead of closures,
clone_from, write! instead of push_str(format!), borrowed Option<&str>, push_of without a needless Option, the
envelope's entity moved instead of cloned, the scheduler's plan() no longer a needless async fn (its doc now says
what it does on failure), sort_unstable, digit separators and inline format args in tests. Not taken: missing
# Errors/# Panics docs, must_use, doc backticks, assert!(x.is_empty()) in tests, too_many_lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 22:33:31 +02:00
parent 8cb42f85a9
commit c942d73c66
18 changed files with 56 additions and 43 deletions
@@ -6,6 +6,8 @@
//! `from` query parameter (the inviting admin's display name, set by E-12's link) is only passed on into the
//! `kvitt://invite` link, never shown. Any code of 1 to 32 characters gets 200; anything else a 404 page.
use std::fmt::Write as _;
use axum::extract::{Path, RawQuery, State};
use axum::http::{HeaderMap, HeaderValue, StatusCode, header};
use axum::response::{IntoResponse, Response};
@@ -153,10 +155,11 @@ pub fn render(
utf8_percent_encode(&code, NON_ALPHANUMERIC)
);
if let Some(name) = from {
open_url.push_str(&format!(
let _ = write!(
open_url,
"&{FROM_PARAM}={}",
utf8_percent_encode(name, NON_ALPHANUMERIC)
));
);
}
let download = download_url
.map(|url| {
+3 -3
View File
@@ -22,8 +22,8 @@ pub fn uuid(text: &str) -> Result<Uuid, AppError> {
Uuid::parse_str(text).map_err(|e| AppError::internal(format!("stored id is not a uuid: {e}")))
}
fn opt_uuid(text: Option<String>) -> Result<Option<Uuid>, AppError> {
text.as_deref().map(uuid).transpose()
fn opt_uuid(text: Option<&str>) -> Result<Option<Uuid>, AppError> {
text.map(uuid).transpose()
}
/// Parses a stored snake_case enum token through its serde form.
@@ -504,7 +504,7 @@ pub async fn expense(conn: &mut SqliteConnection, id: Uuid) -> Result<Option<Exp
})
})
.collect::<Result<_, AppError>>()?,
recurring_template_id: opt_uuid(row.recurring_template_id)?,
recurring_template_id: opt_uuid(row.recurring_template_id.as_deref())?,
recurring_period: row.recurring_period,
created_by_user_id: uuid(&row.created_by_user_id)?,
updated_by_user_id: uuid(&row.updated_by_user_id)?,