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
+2 -4
View File
@@ -136,8 +136,7 @@ async fn log_request(request: Request, next: Next) -> Response {
let route = request
.extensions()
.get::<MatchedPath>()
.map(|p| p.as_str().to_owned())
.unwrap_or_else(|| "<unmatched>".to_owned());
.map_or_else(|| "<unmatched>".to_owned(), |p| p.as_str().to_owned());
let span = tracing::info_span!(
"request",
method = %method,
@@ -151,8 +150,7 @@ async fn log_request(request: Request, next: Next) -> Response {
let error_code = response
.extensions()
.get::<LoggedErrorCode>()
.map(|c| c.0.as_str())
.unwrap_or("");
.map_or("", |c| c.0.as_str());
span.in_scope(|| {
tracing::info!(status, latency_ms, error_code, "request");
});