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:
@@ -75,7 +75,7 @@ impl CategoryTable {
|
||||
else {
|
||||
return Err(format!(
|
||||
"category table: line {} must have three fields",
|
||||
record.position().map_or(0, |p| p.line())
|
||||
record.position().map_or(0, csv::Position::line)
|
||||
));
|
||||
};
|
||||
if name.trim().is_empty() || name.trim() != name {
|
||||
|
||||
@@ -249,12 +249,11 @@ fn plan_row(
|
||||
}
|
||||
|
||||
let category = row.category.trim();
|
||||
let category_key = match ctx.categories.lookup(category) {
|
||||
Some(key) => key.to_owned(),
|
||||
None => {
|
||||
*unmapped.entry(category.to_owned()).or_insert(0) += 1;
|
||||
FALLBACK_KEY.to_owned()
|
||||
}
|
||||
let category_key = if let Some(key) = ctx.categories.lookup(category) {
|
||||
key.to_owned()
|
||||
} else {
|
||||
*unmapped.entry(category.to_owned()).or_insert(0) += 1;
|
||||
FALLBACK_KEY.to_owned()
|
||||
};
|
||||
if description.is_empty() {
|
||||
return Err("empty description".into());
|
||||
|
||||
Reference in New Issue
Block a user